启动分布式项目的时候,遇到Caused by: java.lang.NoClassDefFoundError: org/apache/curator/RetryPolicy这样的错误:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/curator/RetryPolicy
at com.alibaba.dubbo.remoting.zookeeper.curator.CuratorZookeeperTransporter.connect(CuratorZookeeperTransporter.java:26)
at com.alibaba.dubbo.remoting.zookeeper.ZookeeperTransporter$Adaptive.connect(ZookeeperTransporter$Adaptive.java)
at com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry.<init>(ZookeeperRegistry.java:69)
at com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistryFactory.createRegistry(ZookeeperRegistryFactory.java:37)
at com.alibaba.dubbo.registry.support.AbstractRegistryFactory.getRegistry(AbstractRegistryFactory.java:95)
at com.alibaba.dubbo.registry.RegistryFactory$Adaptive.getRegistry(RegistryFactory$Adaptive.java)
at com.alibaba.dubbo.registry.integration.RegistryProtocol.getRegistry(RegistryProtocol.java:200)
at com.alibaba.dubbo.registry.integration.RegistryProtocol.export(RegistryProtocol.java:134)
最后发现是少了jar包(原来没有jar包也是可以运行的,只是换了一个地方就不行了),就加了一个jar包问题解决了
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
<version>4.0.1</version>
</dependency>
希望对遇到同样问题的,有所帮助