Docker-java: Does not work in OSGi enviroionment

Created on 3 Feb 2017  路  10Comments  路  Source: docker-java/docker-java

It would be nice if it worked in OSGi, if the JAR had the right manifest etc.

For example in your jar, your META-INF/MANIFEST.MF looks like the following which is not enough for OSGi:

Manifest-Version: 1.0
Built-By: integer
Created-By: Apache Maven 3.3.9
Build-Jdk: 1.8.0_112

This has the consequence that I cannot use camel-docker component in Apache Karaf.

All 10 comments

I have no idea how OSGI works, maven packaging is jar and it ok for maven.

@PhilAndrew you can use Bundlor tool to create valid OSGi manifest for existing JAR file. The obvious drawback is that you have to host the final JAR in custom Maven repository.

@KostyaSha I can submit PR which enables Bundlor in this project if you are interested.

@PhilAndrew I've made PR that generates OSGi compliant manifest. I've tried docker-java bundle in Eclipse Virgo because I'm familiar with it. Please check if it works on Apache Karaf.

@orzeh How do I create the OSGi jar file from your code at https://github.com/orzeh/docker-java/tree/osgi ?
mvn clean install -DskipITs
That made a jar in target docker-java-3.0.7-SNAPSHOT.jar but in that jar the MANIFEST.MF is not OSGi.

wait.. maybe I didn't checkout right with git

Ok I checked out right and it does make an OSGi jar and now I'm testing
git clone -b osgi [email protected]:orzeh/docker-java.git

Hi @orzeh , why do you exclude the package com.github.dockerjava.core in the template.mf? as DefaultDockerClientConfig exists in com.github.dockerjava.core.DefaultDockerClientConfig as per the example code on the homepage of docker-java.

It works in Felix and Karaf as long as com.github.dockerjava.core is not excluded, and when I say works I mean, its working but not "tested", not running any specific tests, but that's really sufficient to say it works I believe.
You need to give access to the specific classes as needed for any usage as exported packages such as DefaultDockerClientConfig.

@PhilAndrew you are right, I've changed my PR and now it exports com.github.dockerjava.core and subpackages.

Thanks for testing on Karaf and Felix!

Thanks, hope this goes to a snapshot or release soon.

Reference this Apache Camel Docker component wants this https://issues.apache.org/jira/browse/CAMEL-10307

So is this PR correct and everuthing is ok https://github.com/docker-java/docker-java/pull/797 ?

Was this page helpful?
0 / 5 - 0 ratings