javax.servlet.ServletException:Servlet执行引发异常:org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)

时间:2013-12-27 13:55:28

标签: java web-services rest tomcat

您好我在运行JAX-RS WebService时遇到此错误。我正在使用Jersey创建JAX-Rs Web服务。按照http://www.vogella.com/articles/REST/article.html

的链接

异常

javax.servlet.ServletException: Servlet execution threw an exception
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)

根本原因

java.lang.IncompatibleClassChangeError: Class javax.ws.rs.core.Response$Status does not implement the requested interface javax.ws.rs.core.Response$StatusType
    com.sun.jersey.spi.container.ContainerResponse.getStatus(ContainerResponse.java:599)
    com.sun.jersey.spi.container.ContainerResponse$CommittingOutputStream.commitWrite(ContainerResponse.java:157)
    com.sun.jersey.spi.container.ContainerResponse$CommittingOutputStream.write(ContainerResponse.java:134)
    sun.nio.cs.StreamEncoder.writeBytes(Unknown Source)
    sun.nio.cs.StreamEncoder.implFlushBuffer(Unknown Source)
    sun.nio.cs.StreamEncoder.implFlush(Unknown Source)
    sun.nio.cs.StreamEncoder.flush(Unknown Source)
    java.io.OutputStreamWriter.flush(Unknown Source)
    java.io.BufferedWriter.flush(Unknown Source)
    com.sun.jersey.core.util.ReaderWriter.writeToAsString(ReaderWriter.java:191)
    com.sun.jersey.core.provider.AbstractMessageReaderWriterProvider.writeToAsString(AbstractMessageReaderWriterProvider.java:128)
    com.sun.jersey.core.impl.provider.entity.StringProvider.writeTo(StringProvider.java:88)
    com.sun.jersey.core.impl.provider.entity.StringProvider.writeTo(StringProvider.java:58)
    com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:302)
    com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1510)
    com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)
    com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)
    com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)
    com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:540)
    com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:715)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)

注意:Apache Tomcat / 7.0.47日志中提供了根本原因的完整堆栈跟踪。

任何人都可以帮忙。

1 个答案:

答案 0 :(得分:1)

引起的错误是,我需要为泽西客户端JAX-RS-WS使用相同的版本jar。这删除了我的错误。现在我正在成功运行应用程序。