'Apache-curator breaks in OSGi
We are using curator-client in our project which has a shaded bundles of guava(shaded_ref). We are using OSGi container(KARAF) for our application which supports multiple versions of same bundle, basic thing of OSGi. Now after upgrading to curator-client to 5.1.0 & facing NoClassDefFoundException because of we are packing multiple versions of guava in our code base. This is because of transitive dependency of our other bundles are expecting the some hard coded version.
Bundle A -> 16.0
Bundle B -> 18.0
Curator-client/framework/recipes 5.1.1 expecting [27.0, 28)
We have to pack all the three versions for our application. Can anyone please tell me how to mitigate this and come out of this. Also why don't curator framework make the dependency as provided instead shading inside. I have gone through the article still major version step up of guava should be adapted and marked with proper version to use the proper guava.
Even after packing the shaded bundles, still import is expecting [27.0,28)
stack trace:
Caused by: java.lang.NoClassDefFoundError: org/apache/curator/shaded/com/google/common/cache/CacheBuilder
at org.apache.curator.framework.imps.NamespaceWatcherMap.<init>(NamespaceWatcherMap.java:31) ~[?:?]
at org.apache.curator.framework.imps.CuratorFrameworkImpl.<init>(CuratorFrameworkImpl.java:81) ~[?:?]
at org.apache.curator.framework.CuratorFrameworkFactory$Builder.build(CuratorFrameworkFactory.java:145) ~[?:?]
at org.apache.curator.framework.CuratorFrameworkFactory.newClient(CuratorFrameworkFactory.java:100) ~[?:?]
imports:
Import-Package =
org.apache.zookeeper;version="[3.4,4.0)",
org.apache.zookeeper.admin;version="[3.4,4.0)",
org.apache.zookeeper.data;version="[3.4,4.0)",
org.apache.zookeeper.server.quorum;version="[3.4,4.0)",
com.google.common.base;version="[27.0,28)",
com.google.common.collect;version="[27.0,28)",
com.google.common.io;version="[27.0,28)",
com.google.common.util.concurrent;version="[27.0,28)",
org.slf4j;version="[1.7,2)"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
