Discussion:
Jersey 2.7 with Karaf
Pascal Klink
2014-03-26 15:55:37 UTC
Permalink
<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>Hi everyone!</div>

<div>&nbsp;</div>

<div>Im currently trying to create an OSGI based Web Application which is designed to work the following way:</div>

<div>&nbsp;</div>

<div>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.</div>

<div>&nbsp;</div>

<div>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.</div>

<div>&nbsp;</div>

<div>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&#39;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&#39;m using the maven-bundle-plugin in order to create the bundles.</div>

<div>&nbsp;</div>

<div>Thanks in advance for your help,</div>

<div>Pascal</div></div></body></html>
Marek Potociar
2014-03-28 11:50:00 UTC
Permalink
On 26 Mar 2014, at 16:55, Pascal Klink <pascal.klink-S0/***@public.gmane.org> 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
Pascal Klink
2014-03-28 14:38:43 UTC
Permalink
Hi Marek,

it was finally easier than I thought (it was basically an configuration error of the bundle plugin) and everything is now running perfectly well. So no errors which I could report ;)

Greetings,
Pascal 

 

Gesendet: Freitag, 28. März 2014 um 12:50 Uhr
Von: "Marek Potociar" <marek.potociar-QHcLZuEGTsvQT0dZR+***@public.gmane.org>
An: users-ywjJWXFEILO43ww/***@public.gmane.org
Betreff: [Jersey] Re: Jersey 2.7 with Karaf

 

On 26 Mar 2014, at 16:55, Pascal Klink <pascal.klink-S0/***@public.gmane.org> 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[https://github.com/jersey/jersey/blob/2.7/pom.xml#L532]. You can see specific configuration in the module POMs, e.g. core-common[https://github.com/jersey/jersey/blob/2.7/core-common/pom.xml#L113], core-server[https://github.com/jersey/jersey/blob/2.7/core-server/pom.xml#L78], core-client[https://github.com/jersey/jersey/blob/2.7/core-client/pom.xml#L100], grizzly-http[https://github.com/jersey/jersey/blob/2.7/containers/grizzly2-http/pom.xml#L81]. (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
Loading...