alibaba / spring-cloud-alibaba

Spring Cloud Alibaba provides a one-stop solution for application development for the distributed solutions of Alibaba middleware.
https://sca.aliyun.com
Apache License 2.0
27.83k stars 8.32k forks source link

使用zookeeper作为dubbo(springboot)注册中心,应用启动报错ClassNotFoundException: com.alibaba.nacos.api.exception.NacosException #907

Closed hyw520110 closed 4 years ago

hyw520110 commented 5 years ago

使用zookeeper作为dubbo(springboot)注册中心,独立的provider应用启动报错java.lang.IllegalStateException: Failed to load extension class (interface: interface org.apache.dubbo.registry.RegistryFactory, class line: org.apache.dubbo.registry.nacos.NacosRegistryFactory) in jar:file:/Users/a123/.m2/repository/org/apache/dubbo/dubbo/2.7.3/dubbo-2.7.3.jar!/META-INF/dubbo/internal/org.apache.dubbo.registry.RegistryFactory, cause: com/alibaba/nacos/api/exception/NacosException java.lang.IllegalStateException: Failed to load extension class (interface: interface org.apache.dubbo.registry.RegistryFactory, class line: org.apache.dubbo.registry.nacos.NacosRegistryFactory) in jar:file:/Users/a123/.m2/repository/org/apache/dubbo/dubbo/2.7.3/dubbo-2.7.3.jar!/META-INF/dubbo/internal/org.apache.dubbo.registry.RegistryFactory, cause: com/alibaba/nacos/api/exception/NacosException at org.apache.dubbo.common.extension.ExtensionLoader.loadResource(ExtensionLoader.java:709) at org.apache.dubbo.common.extension.ExtensionLoader.loadDirectory(ExtensionLoader.java:678) at org.apache.dubbo.common.extension.ExtensionLoader.loadExtensionClasses(ExtensionLoader.java:636) at org.apache.dubbo.common.extension.ExtensionLoader.getExtensionClasses(ExtensionLoader.java:623) at org.apache.dubbo.common.extension.ExtensionLoader.getSupportedExtensions(ExtensionLoader.java:379) at org.apache.dubbo.common.extension.factory.SpiExtensionFactory.getExtension(SpiExtensionFactory.java:32) at org.apache.dubbo.common.extension.factory.AdaptiveExtensionFactory.getExtension(AdaptiveExtensionFactory.java:47) at org.apache.dubbo.common.extension.ExtensionLoader.injectExtension(ExtensionLoader.java:566) at org.apache.dubbo.common.extension.ExtensionLoader.createExtension(ExtensionLoader.java:535) at org.apache.dubbo.common.extension.ExtensionLoader.getExtension(ExtensionLoader.java:351) at org.apache.dubbo.rpc.Protocol$Adaptive.export(Protocol$Adaptive.java) at org.apache.dubbo.config.ServiceConfig.doExportUrlsFor1Protocol(ServiceConfig.java:607) at org.apache.dubbo.config.ServiceConfig.doExportUrls(ServiceConfig.java:457) at org.apache.dubbo.config.ServiceConfig.doExport(ServiceConfig.java:415) at org.apache.dubbo.config.ServiceConfig.export(ServiceConfig.java:378) at org.apache.dubbo.config.spring.ServiceBean.export(ServiceBean.java:336) at org.apache.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:114) at org.apache.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:60) at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:402) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:359) at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:896) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:163) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) at com.WlzsBooter.main(WlzsBooter.java:35) Caused by: java.lang.NoClassDefFoundError: com/alibaba/nacos/api/exception/NacosException at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at org.apache.dubbo.common.extension.ExtensionLoader.loadResource(ExtensionLoader.java:706) ... 32 more Caused by: java.lang.ClassNotFoundException: com.alibaba.nacos.api.exception.NacosException at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 35 more , dubbo version: 2.7.3, current host: 192.168.1.185

hyw520110 commented 5 years ago

[INFO] +- org.springframework.boot:spring-boot-starter-log4j2:jar:2.1.3.RELEASE:compile [INFO] | +- org.apache.logging.log4j:log4j-slf4j-impl:jar:2.11.2:compile [INFO] | +- org.apache.logging.log4j:log4j-core:jar:2.11.2:compile [INFO] | +- org.apache.logging.log4j:log4j-jul:jar:2.11.2:compile [INFO] | - org.slf4j:jul-to-slf4j:jar:1.7.25:compile [INFO] +- org.apache.logging.log4j:log4j-1.2-api:jar:2.11.2:compile [INFO] | - org.apache.logging.log4j:log4j-api:jar:2.11.2:compile [INFO] +- org.apache.logging.log4j:log4j-web:jar:2.11.2:compile [INFO] +- org.slf4j:jcl-over-slf4j:jar:1.7.25:compile [INFO] | - org.slf4j:slf4j-api:jar:1.7.25:compile [INFO] +- com.lmax:disruptor:jar:3.4.2:compile [INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:2.1.3.RELEASE:compile [INFO] | +- org.springframework.boot:spring-boot-starter:jar:2.1.3.RELEASE:compile [INFO] | | +- org.springframework.boot:spring-boot:jar:2.1.3.RELEASE:compile [INFO] | | - javax.annotation:javax.annotation-api:jar:1.3.2:compile [INFO] | +- org.springframework.boot:spring-boot-actuator-autoconfigure:jar:2.1.3.RELEASE:compile [INFO] | | +- org.springframework.boot:spring-boot-actuator:jar:2.1.3.RELEASE:compile [INFO] | | +- org.springframework:spring-context:jar:5.1.5.RELEASE:compile [INFO] | | - com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.8:compile [INFO] | - io.micrometer:micrometer-core:jar:1.1.3:compile [INFO] | +- org.hdrhistogram:HdrHistogram:jar:2.1.9:compile [INFO] | - org.latencyutils:LatencyUtils:jar:2.0.3:compile [INFO] +- org.springframework.cloud:spring-cloud-starter-zookeeper-config:jar:2.1.2.RELEASE:compile [INFO] | +- org.springframework.cloud:spring-cloud-starter-zookeeper:jar:2.1.2.RELEASE:compile [INFO] | | +- org.springframework.cloud:spring-cloud-commons:jar:2.1.2.RELEASE:compile [INFO] | | - org.springframework.cloud:spring-cloud-zookeeper-core:jar:2.1.2.RELEASE:compile [INFO] | +- org.springframework.cloud:spring-cloud-zookeeper-config:jar:2.1.2.RELEASE:compile [INFO] | +- org.springframework.cloud:spring-cloud-context:jar:2.1.2.RELEASE:compile [INFO] | | - org.springframework.security:spring-security-crypto:jar:5.1.4.RELEASE:compile [INFO] | - org.apache.curator:curator-recipes:jar:4.0.1:compile [INFO] +- org.apache.zookeeper:zookeeper:jar:3.4.13:compile [INFO] | +- jline:jline:jar:0.9.94:compile [INFO] | - org.apache.yetus:audience-annotations:jar:0.5.0:compile [INFO] +- org.apache.curator:curator-framework:jar:4.0.1:compile [INFO] | - org.apache.curator:curator-client:jar:4.0.1:compile [INFO] +- org.apache.dubbo:dubbo-spring-boot-starter:jar:2.7.1:compile [INFO] | - org.apache.dubbo:dubbo-spring-boot-autoconfigure:jar:2.7.1:compile [INFO] | - org.apache.dubbo:dubbo-spring-boot-autoconfigure-compatible:jar:2.7.1:compile [INFO] +- org.apache.dubbo:dubbo:jar:2.7.3:compile [INFO] | +- org.javassist:javassist:jar:3.20.0-GA:compile [INFO] | +- io.netty:netty-all:jar:4.1.33.Final:compile [INFO] | - org.yaml:snakeyaml:jar:1.23:compile [INFO] +- com.google.guava:guava:jar:19.0:compile [INFO] +- org.hibernate.validator:hibernate-validator:jar:6.0.14.Final:compile [INFO] | +- org.jboss.logging:jboss-logging:jar:3.3.2.Final:compile [INFO] | - com.fasterxml:classmate:jar:1.4.0:compile [INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.1.3.RELEASE:compile [INFO] | +- org.springframework.boot:spring-boot-starter-json:jar:2.1.3.RELEASE:compile [INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.9.8:compile [INFO] | | - com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.9.8:compile [INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.1.3.RELEASE:compile [INFO] | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.16:compile [INFO] | | +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.16:compile [INFO] | | - org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.16:compile [INFO] | +- org.springframework:spring-web:jar:5.1.5.RELEASE:compile [INFO] | | - org.springframework:spring-beans:jar:5.1.5.RELEASE:compile [INFO] | - org.springframework:spring-webmvc:jar:5.1.5.RELEASE:compile [INFO] | +- org.springframework:spring-aop:jar:5.1.5.RELEASE:compile [INFO] | - org.springframework:spring-expression:jar:5.1.5.RELEASE:compile [INFO] +- commons-fileupload:commons-fileupload:jar:1.3.1:compile [INFO] | - commons-io:commons-io:jar:2.2:compile [INFO] +- org.mybatis.spring.boot:mybatis-spring-boot-starter:jar:1.3.2:compile [INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.1.3.RELEASE:compile [INFO] | | +- com.zaxxer:HikariCP:jar:3.2.0:compile [INFO] | | - org.springframework:spring-jdbc:jar:5.1.5.RELEASE:compile [INFO] | +- org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:jar:1.3.2:compile [INFO] | +- org.mybatis:mybatis:jar:3.4.6:compile [INFO] | - org.mybatis:mybatis-spring:jar:1.3.2:compile [INFO] +- com.github.pagehelper:pagehelper-spring-boot-starter:jar:1.2.3:compile [INFO] | +- com.github.pagehelper:pagehelper-spring-boot-autoconfigure:jar:1.2.3:compile [INFO] | - com.github.pagehelper:pagehelper:jar:5.1.2:compile [INFO] | - com.github.jsqlparser:jsqlparser:jar:1.0:compile [INFO] +- mysql:mysql-connector-java:jar:6.0.6:compile [INFO] +- com.alibaba:druid-spring-boot-starter:jar:1.1.10:compile [INFO] | +- com.alibaba:druid:jar:1.1.10:compile [INFO] | - org.springframework.boot:spring-boot-autoconfigure:jar:2.1.3.RELEASE:compile [INFO] +- org.springframework:spring-aspects:jar:5.1.5.RELEASE:compile [INFO] +- com.thoughtworks.xstream:xstream:jar:1.4.10:compile [INFO] | +- xmlpull:xmlpull:jar:1.1.3.1:compile [INFO] | - xpp3:xpp3_min:jar:1.1.4c:compile [INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.9.8:compile [INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.8:compile [INFO] | - com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile [INFO] +- org.apache.httpcomponents:httpcore:jar:4.4.11:compile [INFO] +- org.apache.httpcomponents:httpclient:jar:4.5.7:compile [INFO] | - commons-codec:commons-codec:jar:1.11:compile [INFO] +- org.apache.httpcomponents:httpmime:jar:4.5.7:compile [INFO] +- com.sun.jersey:jersey-bundle:jar:1.19:compile [INFO] | - javax.ws.rs:jsr311-api:jar:1.1.1:compile [INFO] +- com.google.code.gson:gson:jar:2.8.5:compile [INFO] +- com.squareup.okhttp:okhttp:jar:2.7.5:compile [INFO] | - com.squareup.okio:okio:jar:1.6.0:compile [INFO] +- signalr:signalr:jar:1.0:compile [INFO] +- signalr:web-socket:jar:1.0:compile [INFO] +- com.alibaba:fastjson:jar:1.2.46:compile [INFO] +- org.apache.commons:commons-lang3:jar:3.8.1:compile [INFO] +- io.springfox:springfox-swagger2:jar:2.7.0:provided [INFO] | +- io.swagger:swagger-annotations:jar:1.5.19:provided [INFO] | +- io.swagger:swagger-models:jar:1.5.13:provided [INFO] | +- io.springfox:springfox-spi:jar:2.7.0:provided [INFO] | | - io.springfox:springfox-core:jar:2.7.0:provided [INFO] | +- io.springfox:springfox-schema:jar:2.7.0:provided [INFO] | +- io.springfox:springfox-swagger-common:jar:2.7.0:provided [INFO] | +- io.springfox:springfox-spring-web:jar:2.7.0:provided [INFO] | | - org.reflections:reflections:jar:0.9.11:provided [INFO] | +- org.springframework.plugin:spring-plugin-core:jar:1.2.0.RELEASE:provided [INFO] | +- org.springframework.plugin:spring-plugin-metadata:jar:1.2.0.RELEASE:provided [INFO] | - org.mapstruct:mapstruct:jar:1.1.0.Final:provided [INFO] +- io.springfox:springfox-swagger-ui:jar:2.7.0:provided [INFO] +- org.springframework.boot:spring-boot-starter-data-redis:jar:2.1.3.RELEASE:compile [INFO] | - org.springframework.data:spring-data-redis:jar:2.1.5.RELEASE:compile [INFO] | +- org.springframework.data:spring-data-keyvalue:jar:2.1.5.RELEASE:compile [INFO] | | - org.springframework.data:spring-data-commons:jar:2.1.5.RELEASE:compile [INFO] | +- org.springframework:spring-tx:jar:5.1.5.RELEASE:compile [INFO] | +- org.springframework:spring-oxm:jar:5.1.5.RELEASE:compile [INFO] | - org.springframework:spring-context-support:jar:5.1.5.RELEASE:compile [INFO] +- org.apache.commons:commons-pool2:jar:2.6.1:compile [INFO] +- redis.clients:jedis:jar:2.9.1:compile [INFO] +- org.springframework.session:spring-session-data-redis:jar:2.1.4.RELEASE:compile [INFO] | - org.springframework.session:spring-session-core:jar:2.1.4.RELEASE:compile [INFO] | - org.springframework:spring-jcl:jar:5.1.5.RELEASE:compile [INFO] +- javax.validation:validation-api:jar:2.0.1.Final:compile [INFO] +- org.aspectj:aspectjweaver:jar:1.9.2:compile [INFO] +- com.fasterxml.jackson.dataformat:jackson-dataformat-xml:jar:2.9.8:compile [INFO] | +- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.9.8:compile [INFO] | +- org.codehaus.woodstox:stax2-api:jar:3.1.4:compile [INFO] | - com.fasterxml.woodstox:woodstox-core:jar:5.0.3:compile [INFO] - org.springframework.boot:spring-boot-starter-test:jar:2.1.3.RELEASE:test [INFO] +- org.springframework.boot:spring-boot-test:jar:2.1.3.RELEASE:test [INFO] +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.1.3.RELEASE:test [INFO] +- com.jayway.jsonpath:json-path:jar:2.4.0:test [INFO] | - net.minidev:json-smart:jar:2.3:test [INFO] | - net.minidev:accessors-smart:jar:1.2:test [INFO] | - org.ow2.asm:asm:jar:5.0.4:test [INFO] +- junit:junit:jar:4.12:test [INFO] +- org.assertj:assertj-core:jar:3.11.1:test [INFO] +- org.mockito:mockito-core:jar:2.23.4:test [INFO] | +- net.bytebuddy:byte-buddy:jar:1.9.10:provided [INFO] | +- net.bytebuddy:byte-buddy-agent:jar:1.9.10:test [INFO] | - org.objenesis:objenesis:jar:2.6:test [INFO] +- org.hamcrest:hamcrest-core:jar:1.3:test [INFO] +- org.hamcrest:hamcrest-library:jar:1.3:test [INFO] +- org.skyscreamer:jsonassert:jar:1.5.0:test [INFO] | - com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test [INFO] +- org.springframework:spring-core:jar:5.1.5.RELEASE:compile [INFO] +- org.springframework:spring-test:jar:5.1.5.RELEASE:test [INFO] - org.xmlunit:xmlunit-core:jar:2.6.2:test

echooymxq commented 5 years ago

You didn't use dependencies with Spring Cloud Alibaba, I think you shoud be open a issue at https://github.com/apache/dubbo-spring-boot-project/issues