users@jersey.java.net

[Jersey] Re: Jersey 2.7 with Karaf

From: Marek Potociar <marek.potociar_at_oracle.com>
Date: Fri, 28 Mar 2014 12:50:00 +0100

On 26 Mar 2014, at 16:55, Pascal Klink <pascal.klink_at_web.de> wrote:

> Hi everyone!
>
> Im currently trying to create an OSGI based Web Application which is designed to work the following way:
>
> There exists a Database which can be accessed through an OSGI service (which is a DataSource). There exists a WebServer (Grizzly) which waits for HttpHandlers to be published as OSGI Services and then registers them. Finally there can exist multiple HttpHandler Services which will perform actions on the database or server static content.
>
> The problems which are slowly exasperating me are the OSGI dependencies of the Jersey modules (server, client, common, container-grizzly2-http). When creating the bundle, those jars create a huge amount of dependencies from which some cannot be resolved at startup.

In Jersey we do our best to produce the proper OSGI export/import headers in our META-INF/MANIFEST.MF files. We use org.apache.felix:maven-bundle-plugin to do the job when our jars are produced. If you know of any OSGi header issues in our modules, it would be good to point these issues out explicitly. Since nobody in the Jersey core team is an OSGi guru (and neither we are ultimate fans of OSGi as such), providing a hint how to fix these OSGi issues would greatly help too.

FYI, you can see the parent configuration for the maven-bundle-plugin in the root Jersey POM. You can see specific configuration in the module POMs, e.g. core-common, core-server, core-client, grizzly-http. (The links are for the Jersey 2.7 release sources.)

Marek

>
> So the question is: Can anybody tell me how to properly create bundles of those jersey modules which export their jersey packages and can be deployed in an osgi container (I'm using karaf) without relying on any other packages? Because then I could just import the corressponding packages in my bundles and would not have to deal with the dependencies of the modules. I'm using the maven-bundle-plugin in order to create the bundles.
> .
> Thanks in advance for your help,
> Pascal