Im trying to write an osgi-application that should make use of the org.elasticsearch.client.RestHighLevelClient. For this I have added the bundle servicemix.bundles.elasticsearch-client since it exports org.elasticsearch.client with the needed RestHighLevelClient. Apparently though, it seems that the RestHighLevelClient needs servicemix.bundles.elasticsearch (amongst others) to work so I add that aswell - both of the same version. Both of the bundles export org.elasticsearch.client but with different content. Everything loads as expected and I can verify the exported packages.
EDIT: The problem that im getting reviels it self as a ClassNotFound-exception for org.elasticsearch.client.RestHighLevelClient. Which is odd since I can view that the elasticsearch-client is available and exporting the requred package.
My interpretation is that Karaf doesent seem to be able to handle shared packages. It seem to load one of the bundles that have the required package to suffice the requirement from my application-feature, and after that decides that it is enough even though the needed class actually exist in the the other bundle.
After comments from @ChristianSchneider and gaining some more understanding I have updated my configuration. However, the issue still remains.
I now have a elastisearch-client6-feature and an elasticsearch6-feature
<feature name="elasticsearch6" version="6.3.2" description="Elasticsearch Base libraries"> <bundle start-level="80">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch/6.3.2_1</bundle> <bundle dependency="true">mvn:com.fasterxml.jackson.dataformat/jackson-dataformat-cbor/2.9.6</bundle> <bundle dependency="true">mvn:com.fasterxml.jackson.core/jackson-core/2.9.6</bundle> <bundle dependency="true">wrap:mvn:com.vividsolutions/jts/1.13</bundle> <bundle dependency="true">wrap:mvn:io.sgr/s2-geometry-library-java/1.0.0</bundle> <bundle dependency="true"><![CDATA[wrap:mvn:io.netty/netty-all/4.1.28.Final$Bundle-Version=4.1.28&Export-Package=*;version=4.1.28]]></bundle> <bundle dependency="true">wrap:mvn:org.locationtech.jts/jts-core/1.15.1</bundle> </feature> <feature name="elasticsearch-client6" version="6.3.2" description="Elasticsearch Client libraries"> <bundle start-level="80">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch-client/6.3.2_1</bundle> </feature>
and my application-feature
<feature name="my-application" version="${version}"> <bundle start-level="92">mvn:com.mycompany/application-feature/${version}</bundle> </feature>
Can someone please suggest how I force my application-feature to both load the elasticsearch-client6-feature aswell as elasticesearch6 as they are both required.
Kind regards Jiinx