动物园管理员:java.lang.ClassNotFoundException:org.apache.zookeeper.admin.ZooKeeperAdmin

时间:2021-04-06 13:12:59

标签: java spring-boot apache-zookeeper spring-cloud-zookeeper

我有一个版本为 3.4.10 的 zookeeper 和版本为 2.12.0 的 curator,但版本低于 3.5.8 的 zookeeper 对 log4j1 有严格的传递依赖。 我想使用 log4j2 这就是为什么需要更新 zookeeper 版本。我尝试了不同的组合:

  1. zookeeper 3.6.1 和 curator 5.1.0
  2. zookeeper 3.5.9 和 curator 5.1.0
  3. zookeeper 3.5.9 和 curator 5.0.0
  4. zookeeper 3.5.9 和 curator 5.1.0 + 从 curator 中排除 zookeeper 依赖
  5. zookeeper 3.5.9 和 curator 4.3.0 + 从 curator 中排除 zookeeper 依赖
  6. zookeeper 3.6.1 和 curator 5.1.0 + 从 curator 中排除 zookeeper 依赖

所有这些选项都失败了。 1 个选项失败并显示以下堆栈跟踪:

 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 个选项看起来具有相同的轨迹:

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)   

实际上,ZooKeeperAdmin 类从 3.5.7 开始就出现在 Zookeeper 中,这就是为什么找不到它的原因。

有人可以提出任何建议吗?这是依赖版本的问题吗(我找不到 zk > 3.4 with curator 的任何详细信息)?或者有什么方法可以调试和了解这个问题?

0 个答案:

没有答案