I'm deploying a web service application on Weblogic 12. The application uses jersey and thus depends on javax.ws.rs-api:2.0.1 library.
However when I deploy it to server I have a following error :
Caused By: java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map;
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:304)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:285)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:311)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:170)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:358)
at javax.servlet.GenericServlet.init(GenericServlet.java:240)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:337)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:288)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
...
I think that weblogic might have it's own version of javax.ws.rs.core.Application that doesn't have this getProperties() method. I'm packaging the application in a WAR file and tried to use
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
in weblogic.xml, to explicitly tell Weblogic to use 2.0.1 version of this library.
Nothing helped so far, the issue still in place..
Thanks.
I found this to work as a solution. Add it in your weblogic.xml:
<wls:container-descriptor>
<wls:prefer-application-packages>
<!-- jersey-bundle-*.jar-->
<wls:package-name>com.sun.jersey.*</wls:package-name>
<wls:package-name>com.sun.research.ws.wadl.*</wls:package-name>
<wls:package-name>com.sun.ws.rs.ext.*</wls:package-name>
<!-- Jackson-*.jar -->
<wls:package-name>org.codehaus.jackson.*</wls:package-name>
<!-- jettison-*.jar -->
<wls:package-name>org.codehaus.jettison.*</wls:package-name>
<!-- jsr311*.jar -->
<wls:package-name>javax.ws.rs.*</wls:package-name>
<!-- asm.jar -->
<wls:package-name>org.objectweb.asm.*</wls:package-name>
</wls:prefer-application-packages>
</wls:container-descriptor>
Reference from Oracle Weblogic Documenation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With