Hi Karaf users,

My bundle is using Elasticsearch 7.x. jars and everything is almost working 
well, except for internal classes not being constructed well. Code is working 
no tests outside Karaf.

While investigating, I’ve found this piece of code

XContentBuilder.class:117 (Elastic)

 // Load pluggable extensions
        for (XContentBuilderExtension service : 
ServiceLoader.load(XContentBuilderExtension.class)) {
            Map<Class<?>, Writer> addlWriters = service.getXContentWriters();  

Jar file has META-INF/services file for XContentBuilderExtension (the piece of 
code that is not being resolved while using Karaf). I’m using 4.2.7

Unfortunately, Elasting isn’t OSGi ready either (no Bundle META):

karaf@root()> bundle:install -s mvn:org.elasticsearch/elasticsearch/7.6.2
Bundle IDs: 
Error executing command: Error installing bundles:
        Unable to install bundle mvn:org.elasticsearch/elasticsearch/7.6.2: 
org.osgi.framework.BundleException: OSGi R3 bundle not supported
karaf@root()> bundle:install -s 
mvn:org.elasticsearch.client/elasticsearch-rest-high-level-client/7.6.2
Bundle IDs: 
Error executing command: Error installing bundles:
        Unable to install bundle 
mvn:org.elasticsearch.client/elasticsearch-rest-high-level-client/7.6.2: 
org.osgi.framework.BundleException: OSGi R3 bundle not supported


Is there a way to make sure ServiceLoader is able to work with JARs inside 
bundle’s class path?

Thanks,

Davi

Reply via email to