My application was initially working fine on Jboss5
and now I deployed it on Wildfly9
. And I am getting below exception:
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.sun.jersey.core.header.MediaTypes
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.sun.jersey.core.header.MediaTypes
at com.sun.jersey.core.spi.factory.MessageBodyFactory.initReaders(MessageBodyFactory.java:182)
at com.sun.jersey.core.spi.factory.MessageBodyFactory.initReaders(MessageBodyFactory.java:176)
at com.sun.jersey.core.spi.factory.MessageBodyFactory.init(MessageBodyFactory.java:162)
at com.sun.jersey.api.client.Client.init(Client.java:343)
at com.sun.jersey.api.client.Client.access$000(Client.java:119)
at com.sun.jersey.api.client.Client$1.f(Client.java:192)
at com.sun.jersey.api.client.Client$1.f(Client.java:188)
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
at com.sun.jersey.api.client.Client.<init>(Client.java:188)
at com.sun.jersey.api.client.Client.<init>(Client.java:160)
at com.sun.jersey.api.client.Client.create(Client.java:673)
Following jersey
jars are already present in the lib but still I am getting this error. can anyone please help me with any pointer.
jersey-client-1.19.3.jar
jersey-core-1.19.3.jar
As point by @BalusC, you don't need to add jersey bundle as wildfly9
comes along with RestEASY
, which is similar to Jersey
an implementation of JAX-RS
. So, you are mixing jersey
and resteasy
in same application.
If you look at the exception, it is trying to load class from jersey
Could not initialize class com.sun.jersey.core.header.MediaTypes
So, you need to change the implementation to load from RestEASY (if you have something similar there)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.