Jersey exception only thrown when depencencies assembled into a single jar

后端 未结 2 514
伪装坚强ぢ
伪装坚强ぢ 2020-12-05 04:48

I\'m writing a server that embeds Jetty w/ Jersey. When I execute from Eclipse, everything is great. However, if I assemble my server and all dependencies into a single ja

相关标签:
2条回答
  • 2020-12-05 05:15

    You are not merging Jersey jars correctly.

    Jersey 1.x uses META-INF/services mechanism to discover its components and assembly:single probably just copies everything into single jar, overriding already present files BUT META-INF/services file(s) needs to be CONCATENATED.

    Try using jersey-bundle (com.sun.jersey:jersey-bundle:1.14) or fix your assembly settings (or find another plugin to do it better).

    0 讨论(0)
  • 2020-12-05 05:33

    Could you post your pom ?

    Do you mark some dependencies as provided ? It's something quite different to build a standalone app and a webapp, as some jars a supposed to be provided by the web container (tomcat or other).

    As your container is "embedded" in your app (and not your app in the container) then maybe you don't manage correctly these dependencies.

    0 讨论(0)
提交回复
热议问题