OSGi JAX-RS Connector 2.0 released

OSGi JAX-RS Connector 2.0 released

Back in January 2012, I wrote about the release of the OSGi JAX-RS connector in version 1.0. The connector gives you the opportunity to publish resources by registering @Path annotated types as OSGi services. I’m glad to say that the connector is in production use in many projects. It is pretty stable and as a result there was not much need for maintenance. So, why release a version 2.0? A few weeks ago I wanted to provide a small REST API using Apache Karaf as runtime. For this I also wanted to use the JAX-RS connector. Unfortunately, I had to accept that the connector was not able to run on Karaf and Felix because of certain issues.

I had to rework some of the connector internals and update the Jersey bundles to 1.13.0 to make it work. But, internal rework is no reason for a 2.0, right? Unless, during the rework something results in a breaking change. In version 1.0 of the connector all resources were registered on /. Sadly, this is not possible using Karaf and it’s HTTPService implementation. Therefore, the new root path of the registered resources is /services. The good news is that it’s configurable ;). You can use the config admin to change the root path. For this the service.pid is com.eclipsesource.jaxrs.connector. The only property supported is root which needs to be a valid path (like with servlets, it has to begin with /).

To put it all together, the internal rework, the Jersey update and the new path gave me reason to bump it to 2.0 to make the breaking change visible. I hope you like the new version. As a reminder here are the most important resources:

GitHub repository: https://github.com/hstaudacher/osgi-jax-rs-connector

p2 repository: https://hstaudacher.github.com/osgi-jax-rs-connector

As always, feel free to comment ;).

<a href="https://twitter.com/hstaudacher"><img title="Follow @hstaudacher" src="https://download.eclipsesource.com/~hstaudacher/followme.png" alt="" width="191" height="58" border="0" /></a>

  • Lars Vogel
    Posted at 13:16, 2012-08-28

    I’m not sure if see how to use this. Lets say I have a server which offers RESTful API, my assumption is what I could use your connector to publish these resources as OSGi services. And afterwards I could for example use OSGi remote services in an RCP application to connect to the server.

    Is that the right use case?

  • Hendy Irawan
    Posted at 15:11, 2012-08-29


    For those interested, it’s also nice to use CXF in Karaf with JAX-RS support built-in. To register REST resources you use Blueprint.

    An example Blueprint XML for CXF & JAX-RS from our project : https://pastebin.com/CUjQmWrx

  • Hugo
    Posted at 22:38, 2012-09-08

    I’m having a problem installing your connector to my OSGi instance, it gives the following error:

    The bundle “com.eclipsesource.jaxrs.connector_2.0.0.201208151950 [125]” could not be resolved. Reason: Missing Constraint: Import-Package: org.osgi.service.cm; version=”[1.4.0,2.0.0)”

    Do you know by any chance what’s the problem? Do you think your version 1.0 of the connector might solve the problem? Do you still have the link to version 1.0.0?

    Thank you

  • Chris Brind
    Posted at 00:45, 2012-10-24

    Hi Holger,

    Quick question, hopefully… I’m trying to get this running but the bundle seems to get stuck in the “starting” state. I wonder if I’m missing any dependencies or something? You can see my configuration here:


    Thanks in advance.


  • Chris Brind
    Posted at 18:54, 2012-10-24

    Nothing in the logs, thought manually stopping and starting it seems to get it in to the Active state. Haven’t had chance to test my resource yet though. 🙂