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

江枫思渺然 提交于 2019-12-05 01:54:54

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

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

Jersey uses hk2-locator to find services on OSGi.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!