Side note: no need to send the same mail 3 times ;)
BTW this dependency works fine on tomee:
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>2.23</version>
<exclusions> <!-- not mandatory but cleaner since skipped anyway -->
<exclusion>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>javax.inject</artifactId>
</exclusion>
<exclusion>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</exclusion>
</exclusions>
</dependency>
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>
2016-06-08 8:50 GMT+02:00 Romain Manni-Bucau <[email protected]>:
> Hi
>
> this stack shows that tomee tried to load it from the webapp but failed.
> The NoClassDefFoundError tend to show that is cause it misses a
> dependency of ResourceFinder and that the issue is not directly
> ResourceFinder.
>
> Can you share your project on github and reproduce it with
> tomee-maven-plugin? This way we could spot it very quickly ensuring we use
> the same setup than you.
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> | Blog
> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> <http://rmannibucau.wordpress.com> | Github
> <https://github.com/rmannibucau> | LinkedIn
> <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
>
> 2016-06-08 7:54 GMT+02:00 rvinjamu <[email protected]>:
>
>> 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-REST-Provider-integrated-into-TOMEE-Plus-tp4678792.html
>> Sent from the TomEE Users mailing list archive at Nabble.com.
>>
>
>