Skip to content

How to eliminate '[DUBBO] publishProvider interfaceName is empty ' error in class InMemoryWritableMetadataService ?? #6241

@zmapleshine

Description

@zmapleshine
  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.7.6
  • Operating System version: Win10
  • Java version: 1.8

Steps to reproduce this issue

  1. import spring-cloud-starter-dubb
  2. config consumer:
 dubbo:
  consumer:
    check: false
  #    timeout: 5000
  protocol:
    name: dubbo
    port: -1
  cloud:
    subscribed-services: 'spring-cloud-alibaba-dubbo-provider'
  1. config provider
dubbo:
  scan:
    base-packages: com.example.test.dubbo.provider.service
  protocol:
    name: dubbo
    port: -1
  registry:
    address: spring-cloud://localhost
  cloud:
    subscribed-services: ''
  1. run provider and consumer

Pls. provide [GitHub address] to reproduce this issue.

Expected Result

What do you expected from the above steps?
no error log

Actual Result

What actually happens?

Console print an error log:

2020-05-28 18:41:20.682 [spring-cloud-alibaba-dubbo-consumer,,,,] 22320 --- [           main] .a.d.m.s.InMemoryWritableMetadataService :  [DUBBO] publishProvider interfaceName is empty . providerUrl: consumer://10.176.128.248/com.alibaba.cloud.dubbo.service.DubboMetadataService?application=spring-cloud-alibaba-dubbo-consumer&check=false&dubbo=2.0.2&generic=true&group=spring-cloud-alibaba-dubbo-provider&interface=com.alibaba.cloud.dubbo.service.DubboMetadataService&pid=22320&qos.enable=false&release=2.7

If there is an exception, please attach the exception trace:

Just put your stack trace here!

Reference code:

 public void publishServiceDefinition(URL providerUrl) {
        try {
            String interfaceName = providerUrl.getParameter(INTERFACE_KEY);
            if (StringUtils.isNotEmpty(interfaceName)
                    && !ProtocolUtils.isGeneric(providerUrl.getParameter(GENERIC_KEY))) {
                Class interfaceClass = Class.forName(interfaceName);
                ServiceDefinition serviceDefinition = ServiceDefinitionBuilder.build(interfaceClass);
                Gson gson = new Gson();
                String data = gson.toJson(serviceDefinition);
                serviceDefinitions.put(providerUrl.getServiceKey(), data);
                return;
            }
            logger.error("publishProvider interfaceName is empty . providerUrl: " + providerUrl.toFullString());
        } catch (ClassNotFoundException e) {
            //ignore error
            logger.error("publishProvider getServiceDescriptor error. providerUrl: " + providerUrl.toFullString(), e);
        }
    }
public static boolean isGeneric(String generic) {
        return StringUtils.isNotEmpty(generic)
                && (GENERIC_SERIALIZATION_DEFAULT.equalsIgnoreCase(generic)  /* Normal generalization cal */
                || GENERIC_SERIALIZATION_NATIVE_JAVA.equalsIgnoreCase(generic) /* Streaming generalization call supporting jdk serialization */
                || GENERIC_SERIALIZATION_BEAN.equalsIgnoreCase(generic)
                || GENERIC_SERIALIZATION_PROTOBUF.equalsIgnoreCase(generic)
                || GENERIC_RAW_RETURN.equalsIgnoreCase(generic));

    }

How to eliminate this error?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions