I had a zookeeper with version 3.4.10 and curator with version 2.12.0 but zookeeper with versions less than 3.5.8 has a strict transitive dependency on log4j1. I would like to use log4j2 that's why it's require to update zookeeper version. I tried different combinations:
- zookeeper 3.6.1 and curator 5.1.0
- zookeeper 3.5.9 and curator 5.1.0
- zookeeper 3.5.9 and curator 5.0.0
- zookeeper 3.5.9 and curator 5.1.0 + exclude zookeeper dependency from curator
- zookeeper 3.5.9 and curator 4.3.0 + exclude zookeeper dependency from curator
- zookeeper 3.6.1 and curator 5.1.0 + exclude zookeeper dependency from curator
All of these options fail. 1 option is failing with the following stacktrace:
java.lang.NoSuchMethodError: org.apache.zookeeper.ZooKeeper.close(I)Z
2021-04-05 14:22:19.633 WARN o.a.c.loader.WebappClassLoaderBase The web application [ROOT] appears to have started a thread named [main-EventThread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2044)
java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:495)
2021-04-05 14:22:19.638 ERROR c.w.event.ApplicationFailedListener ApplicationFailedEvent, possibly port is not available or analyze message above, application will be restarted
2-6 options look like has the same stracktrace:
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'zookeeperPropertySourceLocator' defined in org.springframework.cloud.zookeeper.config.ZookeeperConfigBootstrapConfiguration: Unsatisfied dependency
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'curatorFramework' defined in org.springframework.cloud.zookeeper.ZookeeperAutoConfiguration: Bean instantiation via factory method failed; nested exception i ...
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.curator.framework.CuratorFramework]: Factory method 'curatorFramework' threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/zookee
Caused by: java.lang.NoClassDefFoundError: org/apache/zookeeper/admin/ZooKeeperAdmin
at org.apache.curator.framework.CuratorFrameworkFactory.<clinit>(CuratorFrameworkFactory.java:65)
Caused by: java.lang.ClassNotFoundException: org.apache.zookeeper.admin.ZooKeeperAdmin
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
Actually, ZooKeeperAdmin class presents in Zookeeper since 3.5.7 that's why it's strange why it cannot be found.
Could someone suggest any ideas? Is it an issue with dependencies versions (I couldn't find any details for zk > 3.4 with curator)? Or any way to debug and get understanding of this issue?
1条答案
按热度按时间vaqhlq811#
you may need to check the env of the zookeeper version to whether has the class of org/apache/zookeeper/admin/ZooKeeperAdmin. As I checked the ISSUE of Zookeeper, found that the zookeeperAdmin was new in the below issue. https://issues.apache.org/jira/browse/ZOOKEEPER-3689
and refer to the pr https://github.com/apache/zookeeper/pull/1285
So you may have two methods to solve this problem.