SpringBoot與Dubbo整合報錯排查(Nacos作為註冊中心)

蝸牛楊哥發表於2020-05-07

異常資訊:

java.lang.IllegalStateException: No such extension org.apache.dubbo.registry.RegistryFactory by name nacos

檢視SpringBoot與Dubbo整合依賴的jar包

<dependency>
    <groupId>org.apache.dubbo</groupId>
    <artifactId>dubbo-spring-boot-starter</artifactId>
    <version>2.7.5</version>
    <exclusions>
        <exclusion>
            <artifactId>org.apache.dubbo</artifactId>
            <groupId>dubbo</groupId>
        </exclusion>
    </exclusions>
</dependency>

及專案啟動日誌資訊:
 

2020-05-07 12:32:27.154  INFO 46384 --- [           main] .b.c.e.AwaitingNonWebApplicationListener :  [Dubbo] Current Spring Boot Application is about to shutdown...
2020-05-07 12:32:27.154  INFO 46384 --- [           main] o.a.d.r.support.AbstractRegistryFactory  :  [DUBBO] Close all registries [], dubbo version: 2.7.1, current host: 192.168.227.1
2020-05-07 12:32:27.154  INFO 46384 --- [           main] o.a.d.rpc.protocol.dubbo.DubboProtocol   :  [DUBBO] Close dubbo server: /192.168.227.1:20880, dubbo version: 2.7.1, current host: 192.168.227.1
2020-05-07 12:32:27.156  INFO 46384 --- [           main] o.a.d.remoting.transport.AbstractServer  :  [DUBBO] Close NettyServer bind /0.0.0.0:20880, export /192.168.227.1:20880, dubbo version: 2.7.1, current host: 192.168.227.1
2020-05-07 12:32:27.165  INFO 46384 --- [           main] o.a.d.rpc.protocol.dubbo.DubboProtocol   :  [DUBBO] Unexport service: dubbo://192.168.227.1:20880/com.search.dubbo.springcloud.nacos.api.IHelloService?anyhost=true&application=spring-boot-dubbo-nacos-provider&bean.name=providers:dubbo:com.search.dubbo.springcloud.nacos.api.IHelloService:1.0.0:HelloGroup&bind.ip=192.168.227.1&bind.port=20880&default.deprecated=false&default.dynamic=false&default.register=true&deprecated=false&dubbo=2.0.2&dynamic=false&generic=false&group=HelloGroup&interface=com.search.dubbo.springcloud.nacos.api.IHelloService&methods=sayHello&pid=46384&register=true&release=2.7.1&revision=1.0.0&side=provider&timestamp=1588825945715&version=1.0.0, dubbo version: 2.7.1, current host: 192.168.227.1
2020-05-07 12:32:27.165  INFO 46384 --- [           main] org.apache.dubbo.qos.server.Server       :  [DUBBO] qos-server stopped., dubbo version: 2.7.1, current host: 192.168.227.1
2020-05-07 12:32:27.173  INFO 46384 --- [           main] o.a.d.rpc.protocol.injvm.InjvmProtocol   :  [DUBBO] Unexport service: injvm://127.0.0.1/com.search.dubbo.springcloud.nacos.api.IHelloService?anyhost=true&application=spring-boot-dubbo-nacos-provider&bean.name=providers:dubbo:com.search.dubbo.springcloud.nacos.api.IHelloService:1.0.0:HelloGroup&bind.ip=192.168.227.1&bind.port=20880&default.deprecated=false&default.dynamic=false&default.register=true&deprecated=false&dubbo=2.0.2&dynamic=false&generic=false&group=HelloGroup&interface=com.search.dubbo.springcloud.nacos.api.IHelloService&methods=sayHello&pid=46384&register=true&release=2.7.1&revision=1.0.0&side=provider&timestamp=1588825945715&version=1.0.0, dubbo version: 2.7.1, current host: 192.168.227.1
2020-05-07 12:32:27.174  WARN 46384 --- [           main] o.apache.dubbo.config.DubboShutdownHook  :  [DUBBO] No such extension org.apache.dubbo.registry.RegistryFactory by name nacos, dubbo version: 2.7.1, current host: 192.168.227.1

java.lang.IllegalStateException: No such extension org.apache.dubbo.registry.RegistryFactory by name nacos
    at org.apache.dubbo.common.extension.ExtensionLoader.findException(ExtensionLoader.java:516) ~[dubbo-2.7.1.jar:2.7.1]
    at org.apache.dubbo.common.extension.ExtensionLoader.createExtension(ExtensionLoader.java:523) ~[dubbo-2.7.1.jar:2.7.1]
    at org.apache.dubbo.common.extension.ExtensionLoader.getExtension(ExtensionLoader.java:347) ~[dubbo-2.7.1.jar:2.7.1]
    at org.apache.dubbo.registry.RegistryFactory$Adaptive.getRegistry(RegistryFactory$Adaptive.java) ~[dubbo-2.7.1.jar:2.7.1]
    at org.apache.dubbo.registry.integration.RegistryProtocol.getRegistry(RegistryProtocol.java:273) ~[dubbo-2.7.1.jar:2.7.1]
    at org.apache.dubbo.registry.integration.RegistryProtocol.access$1100(RegistryProtocol.java:95) ~[dubbo-2.7.1.jar:2.7.1]
    at org.apache.dubbo.registry.integration.RegistryProtocol$ExporterChangeableWrapper.unexport(RegistryProtocol.java:644) ~[dubbo-2.7.1.jar:2.7.1]
    at org.apache.dubbo.registry.integration.RegistryProtocol.destroy(RegistryProtocol.java:417) ~[dubbo-2.7.1.jar:2.7.1]
    at org.apache.dubbo.rpc.protocol.ProtocolListenerWrapper.destroy(ProtocolListenerWrapper.java:75) ~[dubbo-2.7.1.jar:2.7.1]
    at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper.destroy(ProtocolFilterWrapper.java:121) ~[dubbo-2.7.1.jar:2.7.1]
    at org.apache.dubbo.qos.protocol.QosProtocolWrapper.destroy(QosProtocolWrapper.java:77) ~[dubbo-2.7.1.jar:2.7.1]

 

執行時使用的dubbo版本為2.7.1

 

解決方案:  升級Dubbo的包

<dependency>
    <groupId>org.apache.dubbo</groupId>
    <artifactId>dubbo</artifactId>
    <version>2.7.5</version>
</dependency>

專案啟動日誌資訊:

 

相關文章