apache / dubbo-spring-boot-project

Spring Boot Project for Apache Dubbo
https://dubbo.apache.org
Apache License 2.0
5.41k stars 1.88k forks source link

SpringBoot 2.1.6项目,只添加dubbo-spring-boot-starter启动报错 #583

Closed dongjunwen closed 5 years ago

dongjunwen commented 5 years ago

启动时报错: java.lang.NoClassDefFoundError: org/apache/curator/framework/CuratorFrameworkFactory 必须添加

<dependency>
                <groupId>org.apache.dubbo</groupId>
                <artifactId>dubbo-dependencies-zookeeper</artifactId>
                <version>2.7.3</version>
                <exclusions>
                    <exclusion>
                        <groupId> org.slf4j</groupId>
                        <artifactId>slf4j-log4j12</artifactId>
                    </exclusion>
                </exclusions>
                <type>pom</type>
</dependency>

才行!

dongjunwen commented 5 years ago

我们公司使用的zookeeper版本是3.4.13

dongjunwen commented 5 years ago

通过依赖树查看,dubbo-spring-boot-starter里并没有对zokeeper的依赖管理,所以需要额外添加,不过dubbo的注册中心一般都是zookeeper,为何不在说明文档里做个说明呢?

+- org.apache.dubbo:dubbo-spring-boot-starter:jar:2.7.3:compile
[INFO] |  \- org.apache.dubbo:dubbo-spring-boot-autoconfigure:jar:2.7.3:compile
[INFO] |     +- org.apache.dubbo:dubbo-spring-boot-autoconfigure-compatible:jar:2.7.3:compile
[INFO] |     \- org.apache.dubbo:dubbo:jar:2.7.3:compile
[INFO] |        +- io.netty:netty-all:jar:4.1.36.Final:compile
[INFO] |        \- com.google.code.gson:gson:jar:2.8.5:compile
[INFO] +- org.apache.dubbo:dubbo-dependencies-zookeeper:pom:2.7.3:compile
[INFO] |  +- org.apache.curator:curator-recipes:jar:4.0.1:compile
[INFO] |  |  \- org.apache.curator:curator-framework:jar:4.0.1:compile
[INFO] |  |     \- org.apache.curator:curator-client:jar:4.0.1:compile
[INFO] |  |        \- com.google.guava:guava:jar:20.0:compile
[INFO] |  \- org.apache.zookeeper:zookeeper:jar:3.4.13:compile
[INFO] |     +- log4j:log4j:jar:1.2.17:compile
[INFO] |     +- jline:jline:jar:0.9.94:compile
[INFO] |     \- org.apache.yetus:audience-annotations:jar:0.5.0:compile
mercyblitz commented 5 years ago

Sorry for confusing on the dependencies in Zookeeper, typically there's the basic guide in README.md, and more details in samples, for this case, you could check the sample about Zookeeper, please refer this declaration in pom.xml:

https://github.com/apache/dubbo-spring-boot-project/blob/master/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/pom.xml#L53

dongjunwen commented 5 years ago

没有看示例,多谢!