当前位置 : 主页 > 手机开发 > 其它 >

缺少与Atmosphere和Jersey的依赖关系

来源:互联网 收集:自由互联 发布时间:2021-06-22
我和泽西岛一起尝试Atmosphere能够向用户广播消息.但是,根据对Jersey端点的请求,日志中会出现以下内容并导致ServletException. SEVERE: The following errors and warnings have been detected with resource and/o
我和泽西岛一起尝试Atmosphere能够向用户广播消息.但是,根据对Jersey端点的请求,日志中会出现以下内容并导致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

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)

我正在使用Maven并添加了以下依赖项:

<dependency>
  <groupId>org.atmosphere</groupId>
  <artifactId>atmosphere-jersey</artifactId>
  <version>0.6.3</version>
</dependency>

我错过了什么?谢谢!

问题显然是应用程序中存在两种JAX-RS实现.这可以通过使Jersey仅扫描包含Rest类的包来解决,因此不知道其他JAX-RS实现.

<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>

感谢Jersey邮件列表上的Paul Sandoz和Atmosphere邮件列表上的Jeanfrancois.

网友评论