Error while using jersey-client in osgi - No generator was provided

Register hk2-locator and javassist as bundles on your OSGi framework.

Jersey uses hk2-locator to find services on OSGi.


Add the following archives from the Jersey-ext-directory to your classpath:

hk2-api-*.jar

hk2-locator-*.jar

hk2-utils-*.jar

javax-inject-*.jar

jersey-guava-*.jar


I had this same issue and I could finally solve it by starting my bundle which uses Jersey to publish an endpoint at level 2 in the Felix Framework (OSGi-5.4). I am not sure why, but seems like the HK2-Locator dependencies:

  • hk2-api-2.4.0-b10.jar -> Level 1
  • hk2-locator-2.4.0-b10.jar -> Level 1
  • hk2-utils-2.4.0-b10.jar -> Level 1
  • org.apache.servicemix.bundles.javax-inject-1_2.jar -> Level 1
  • jersey-guava-2.22.1.jar -> Level 1

need to start first before the bundle who uses them:

  • your-bundle-1.0.0.jar -> Level 2

Once you set your bundle to start on this new level then make sure to execute frameworklevel 2 in Felix console to start the bundles under that level. Restart the framework and it will work.