In working through a different issue I am having, I decided to upgrade from Jersey 1.19 to 2.22.1 with the hope that the directions I was looking at were not applicable to 1.x and upgrading would fix my problem.
Along the way I ran into an odd issue. I upgraded my maven dependencies to 2.x and recompiled. No issues there. I got all the runtime dependencies I could find into my Jetty server but there was one thing I got stuck on. when I would go to run a simple GET, I would get the following stack trace:
java.lang.ClassNotFoundException: com.sun.ws.rs.ext.RuntimeDelegateImpl
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at javax.ws.rs.ext.FactoryFinder.newInstance(FactoryFinder.java:62)
at javax.ws.rs.ext.FactoryFinder.find(FactoryFinder.java:155)
at javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:105)
at javax.ws.rs.ext.RuntimeDelegate.getInstance(RuntimeDelegate.java:91)
at javax.ws.rs.core.EntityTag.<clinit>(EntityTag.java:35)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at sun.proxy.$Proxy21.<clinit>(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.reflect.Proxy.newInstance(Unknown Source)
at java.lang.reflect.Proxy.newProxyInstance(Unknown Source)
at com.sun.jersey.server.impl.application.WebApplicationImpl.createProxy(WebApplicationImpl.java:1592)
at com.sun.jersey.server.impl.application.WebApplicationImpl.<init>(WebApplicationImpl.java:320)
at com.sun.jersey.server.impl.container.WebApplicationProviderImpl.createWebApplication(WebApplicationProviderImpl.java:55)
at com.sun.jersey.spi.container.WebApplicationFactory.createWebApplication(WebApplicationFactory.java:66)
at com.sun.jersey.spi.container.servlet.ServletContainer.create(ServletContainer.java:392)
at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.create(ServletContainer.java:307)
at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:603)
at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:210)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:374)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:557)
FYI: This is a really barebones setup. It's just Jetty with the Jersey servlet-container.
This class didn't come down with the dependencies for 2.22.1 and when I tried to find a reference to what jar this might come from, everything pointed back to jersey-bundle which doesn't seem to be a jar under org.glassfish.jersey.core. There is a file called com.sun.ws.rs.ext.RuntimeDelegateImpl in the jersey-server-2.22.1.jar file under META-INF/services with a single line in it that says: org.glassfish.jersey.server.internal.RuntimeDelegateImpl
For kicks, I threw the jersey-bundle-1.19.jar file into the lib for the web app, and viola! my (very simple) app was working as before.
Id there something messed up with my setup here? I don't understand why there's a reference to a class in the jersey 2.x that isn't included in the Maven dependencies.