You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by rvinjamu <rv...@opentext.com> on 2016/06/08 06:00:57 UTC

Classloading issues with Jersey 2.16 and Tomee Plus

Context:
1. Trying to deploy a REST based Web application in TomEE
2. Disabled OTB JAX-RS service in TOMEE_HOME/conf/conf.d/cxf-rs.properties
3. All Jersey Libraries (along with the dependencies) bundled into
<WEBAPP>/WEB-INF/lib

Observations:
Getting the following Exception during startup of the server

Caused by: java.lang.NoClassDefFoundError:
org/glassfish/hk2/osgiresourcelocator/ResourceFinder
        at
org.glassfish.jersey.internal.l10n.Localizer.localize(Localizer.java:118)
        at
org.glassfish.jersey.servlet.init.internal.LocalizationMessages.JERSEY_APP_REGISTERED_MAPPING(LocalizationMessages.java:27)
        at
org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer.addServletWithApplication(JerseyServletContainerInitializer.java:290)
        at
org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer.onStartupImpl(JerseyServletContainerInitializer.java:177)
        at
org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer.onStartup(JerseyServletContainerInitializer.java:144)
        at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5184)
        at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)
        ... 6 more
Caused by: java.lang.ClassNotFoundException:
org.glassfish.hk2.osgiresourcelocator.ResourceFinder
        at
org.apache.openejb.util.classloader.URLClassLoaderFirst.loadClass(URLClassLoaderFirst.java:140)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        ... 13 more


Jersey has a ServletContextInitializer implementation that is loaded from
one jar - jersey-container-servlet.jar in WEB-INF/lib. The
NoClassDefFoundError is thrown about a referenced class which is there in
another jar osgi-resource-locator-1.0.1.jar also placed in WEB-INF/lib of
the web app.  One would expect that all jars in WEB-INF/lib should be loaded
in the same classloading name space and hence should not face issues in
finding one another. Why am I getting this exception?




--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Classloading-issues-with-Jersey-2-16-and-Tomee-Plus-tp4678793.html
Sent from the TomEE Users mailing list archive at Nabble.com.