apache / dubbo

The java implementation of Apache Dubbo. An RPC and microservice framework.
https://dubbo.apache.org/
Apache License 2.0
40.44k stars 26.42k forks source link

upgrade from 2.7.9 to 2.7.12 and the consumer got NoSuchMethodError for curator "CreateBuilder.creatingParentsIfNeeded". #8072

Closed sh1yu closed 3 years ago

sh1yu commented 3 years ago

Environment

Steps to reproduce this issue

upgrading version 2.7.9 to 2.7.12 and got this exception:

Injection of @DubboReference dependencies is failed; nested exception is java.lang.NoSuchMethodError: org.apache.curator.framework.api.CreateBuilder.creatingParentsIfNeeded()Lorg/apache/curator/framework/api/ProtectACLCreateModeStatPathAndBytesable;

It works ok in version 2.7.9 but got this exception in 2.7.12. Provider code works ok but Consumer is not. the extra infomation:

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.apache.dubbo.registry.zookeeper.ZookeeperServiceDiscovery.registerServiceWatcher(ZookeeperServiceDiscovery.java:196)

The following method did not exist:

    org.apache.curator.framework.api.CreateBuilder.creatingParentsIfNeeded()Lorg/apache/curator/framework/api/ProtectACLCreateModeStatPathAndBytesable;

The method's class, org.apache.curator.framework.api.CreateBuilder, is available from the following locations:

    jar:file:/D:/m2/repository/org/apache/curator/curator-framework/2.12.0/curator-framework-2.12.0.jar!/org/apache/curator/framework/api/CreateBuilder.class

The class hierarchy was loaded from the following locations:

    org.apache.curator.framework.api.CreateBuilder: file:/D:/m2/repository/org/apache/curator/curator-framework/2.12.0/curator-framework-2.12.0.jar

Action:

Correct the classpath of your application so that it contains a single, compatible version of org.apache.curator.framework.api.CreateBuilder
xiaoheng1 commented 3 years ago

This high probability is a problem of zk version conflicts. Do you use other zk version in your project?

sh1yu commented 3 years ago

This high probability is a problem of zk version conflicts. Do you use other zk version in your project?

Yes. zk 3.5.9 and 3.4.14 also have this problem.

xiaoheng1 commented 3 years ago

can you just use the zk version in dubbo and exclude other zk ?

ericren commented 3 years ago

我们遇到了同样的问题,可不可以不升级curator的version(我们目前也使用2.12.0),而修复这个bug 因为要升级的话,我们有几百个应用要动,这个成本太大,能否在2.7的版本下,加个小版本修复? We have the same problem. Can you fix this bug without upgrading the version of curator? (we also use 2.12.0 now.) Because we have hundreds of applications to upgrade. The cost is too high.

Thank you very much!

AlbumenJ commented 3 years ago

我们遇到了同样的问题,可不可以不升级curator的version(我们目前也使用2.12.0),而修复这个bug 因为要升级的话,我们有几百个应用要动,这个成本太大,能否在2.7的版本下,加个小版本修复? We have the same problem. Can you fix this bug without upgrading the version of curator? (we also use 2.12.0 now.) Because we have hundreds of applications to upgrade. The cost is too high.

Thank you very much!

这部分逻辑是需要使用应用级服务发现才会有的,当前 2.7 版本的应用级服务发现是处于原型状态,后续不再继续维护的。关于 zookeeper 版本的短期是可以做一个兼容。但是长期来看肯定是要往高版本升级的,目前 zookeeper 官方也对低版本不维护了。

ericren commented 3 years ago

@AlbumenJ 谢谢。 我目前的解决方案是:dubbo升级到2.7.12,curator升级到4.2.0,排除curator本身的zk版本,引用了自己的3.4.8的zk版本 图片 另外,还发现一点:用过2.7.9的,在zookeeper目录下,找到/dubbo/config,下面有个mapping目录,这个在用2.7.12前要删除,否则会报错。 图片

sh1yu commented 3 years ago

in fact it still recommend to use zookeeper: 3.4.9 and curator: 2.12.0 in the doc for dubbo 2.7. https://dubbo.apache.org/zh/docs/v2.7/user/dependencies/

I would appreciated if it could be updated for dubbo 2.7.12 and other subversion for production use. I'm not very clear that which zookeeper cluster version, zookeeper client version and curator version whould be perfect for dubbo 2.7.12.