My webapp contains a library which contains a class annotated with @javax.ws.rs.ext.Provider
. If this class is present, my webapp (deployed as a WAR within an EAR) fails to start with the following error:
<19-Jun-2014 14:41:50 o'clock BST> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID "1403185262187" for task "2". Error is: "weblogic.application.ModuleException: com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes."
weblogic.application.ModuleException: com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes.
at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:213)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:208)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
Truncated. see log file for complete stacktrace
Caused By: com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes.
at com.sun.jersey.server.impl.application.RootResourceUriRules.<init>(RootResourceUriRules.java:99)
at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1331)
at com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:168)
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:774)
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:770)
Truncated. see log file for complete stacktrace
I'm not using jersey at all, I'm not using any jax-rs services, and my web.xml contains no jersey related servlets. I don't understand why weblogic initialises jersey and scans jars in my application for jaxrs related stuff.
Most of the information I can find on the internet relating to this results in people configuring their jersey servlet differently. But I don't have one to configure...
I don't control the offending library, so removing the class is not an option.
So, how can I tell weblogic not to scan my classes when it initialises jersey?
Note that this happened after changing my web.xml to servlet 3.0 instead of 2.4. If I change it back to 2.4, everything is fine.
I'm using weblogic 12.1.2.0 (12c).
Update: turns out that JAX-RS scanning is a key feature of Javaee 6 - the whole idea is that you put your annotated classes in your webapp and you don't need to do any configuration to have them exposed as a REST webservice.