Hi jersey community,
The jersey 1.2 OSGi sample don't work in my equniox platform, because of
class loading problems, so I added a proxy class loader in the Activator
class and now it works fine.
Without the proxy class loader I got the follow exception:
java.lang.ClassNotFoundException: com.example.rest.JerseyApplication
at
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:494)
at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at
com.sun.jersey.core.reflection.ReflectionHelper.classForNameWithException(ReflectionHelper.java:219)
at
com.sun.jersey.core.reflection.ReflectionHelper.classForNameWithException(ReflectionHelper.java:199)
at
com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:668)
at
com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:635)
at
com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:201)
at
com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:333)
at
com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:497)
at javax.servlet.GenericServlet.init(GenericServlet.java:241)
at
org.eclipse.equinox.http.servlet.internal.ServletRegistration.init(ServletRegistration.java:64)
at
org.eclipse.equinox.http.servlet.internal.ProxyServlet.registerServlet(ProxyServlet.java:142)
at
org.eclipse.equinox.http.servlet.internal.HttpServiceImpl.registerServlet(HttpServiceImpl.java:59)
at com.example.rest.Activator.rawRegisterServlets(Activator.java:81)
Here (
http://github.com/tux2323/jersey.sample.osgiservice) my fixed OSGi
Jersey Sample.
I also add my eclipse equinox target platform in the git project.
with best regards
Christian