I am trying Atmosphere together with Jersey to be able to broadcast messages to users. However on request to the Jersey endpoint, the following appears in the log and results in ServletException.
SEVERE: The following errors and warnings have been detected with resource and/or provider classes:
SEVERE: Missing dependency for method public void org.apache.cxf.jaxrs.provider.JSONProvider.setMessageContext(org.apache.cxf.jaxrs.ext.MessageContext) at parameter at index 7
SEVERE: Missing dependency for field: private org.apache.cxf.jaxrs.ext.MessageContext org.apache.cxf.jaxrs.provider.RequestDispatcherProvider.mc
SEVERE: Missing dependency for method public void org.apache.cxf.jaxrs.provider.JAXBElementProvider.setMessageContext(org.apache.cxf.jaxrs.ext.MessageContext) at parameter at index 1
SEVERE: Missing dependency for field: private org.apache.cxf.jaxrs.ext.MessageContext org.apache.cxf.jaxrs.provider.MultipartProvider.mc
SEVERE: Missing dependency for method public void org.apache.cxf.jaxrs.provider.JAXBElementProvider.setMessageContext(org.apache.cxf.jaxrs.ext.MessageContext) at parameter at index 13
SEVERE: Missing dependency for field: private org.apache.cxf.jaxrs.ext.MessageContext org.apache.cxf.jaxrs.provider.FormEncodingProvider.mc
Part of stacktrace:
SEVERE: Allocate exception for servlet AtmosphereServlet
javax.servlet.ServletException
at org.atmosphere.cpr.AtmosphereServlet.init(AtmosphereServlet.java:540)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:809)
I am using Maven and have added the following dependency:
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-jersey</artifactId>
<version>0.6.3</version>
</dependency>
What am I missing? Thanks!
The problem was apparently that two implementations of JAX-RS somehow existed in the application. This can be solved by making Jersey scan only the package containing the Rest classes and therefore be unaware of other JAX-RS implementations.
<servlet>
<description>AtmosphereServlet</description>
<servlet-name>AtmosphereServlet</servlet-name>
<servlet-class>org.atmosphere.cpr.AtmosphereServlet</servlet-class>
...
<init-param>
<param-name>com.sun.jersey.config.property.packages</ param-name>
<param-value>mypackage.with.the.rest.classes</param-value>
</init-param>
</servlet>
Thanks to Paul Sandoz on the Jersey mailing list and Jeanfrancois on the Atmosphere mailing list.
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