使用 Jersey ContainerRequestFilter 时获取根本原因 java.lang.AbstractMethodError
INFO: Server startup in 6705 ms
Nov 29, 2013 6:17:38 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [JerseyServlet] in context with path [/jersey_project] threw exception [Servlet execution threw an exception] with root cause
java.lang.AbstractMethodError: javax.ws.rs.core.UriBuilder.uri(Ljava/lang/String;)Ljavax/ws/rs/core/UriBuilder;
at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:119)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:649)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:947)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1009)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
推荐答案
您似乎正在使用带有 JAX-RS 2.0 API 的 Jersey 1.x(JAX-RS 1.1 实现).在您的应用程序中切换到 Jersey 2(推荐)或用 JAX-RS 1.1 API jar 替换 JAX-RS 2.0 API jar(它已经是 jersey-common
的一部分,因此删除 2.0 API 就足够了).
It seems that you're using Jersey 1.x (JAX-RS 1.1 implementation) with JAX-RS 2.0 APIs. In your application either switch to Jersey 2 (recommended) or replace JAX-RS 2.0 API jar with JAX-RS 1.1 API jar (it's already part of the jersey-common
so removing 2.0 API should be sufficient).
相关文章