1

我正在尝试在 Eclipse 中创建一个 JAX-RS Web 服务。我关注了这个http://www.vogella.com/articles/REST/article.html链接。我的本地主机把这些作为我的状态报告

HTTP 状态 500:

type Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

javax.servlet.ServletException: Servlet.init() for servlet Jersey REST Service threw exception
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:46
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
    

org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
        org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
        java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        java.lang.Thread.run(Unknown Source)


root cause 

java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
    com.sun.jersey.api.core.ScanningResourceConfig.init(ScanningResourceConfig.java:79)
    com.sun.jersey.api.core.PackagesResourceConfig.init(PackagesResourceConfig.java:104)
    com.sun.jersey.api.core.PackagesResourceConfig.<init>(PackagesResourceConfig.java:78)
    com.sun.jersey.api.core.PackagesResourceConfig.<init>(PackagesResourceConfig.java:89)
    com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:700)
    com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:678)
    com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:203)
    com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:374)
    com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:557)
    javax.servlet.GenericServlet.init(GenericServlet.java:160)
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
    org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
    java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    java.lang.Thread.run(Unknown Source)

root cause 

java.lang.ClassNotFoundException: org.objectweb.asm.ClassVisitor
    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
    com.sun.jersey.api.core.ScanningResourceConfig.init(ScanningResourceConfig.java:79)
    com.sun.jersey.api.core.PackagesResourceConfig.init(PackagesResourceConfig.java:104)
    com.sun.jersey.api.core.PackagesResourceConfig.<init>(PackagesResourceConfig.java:78)
    com.sun.jersey.api.core.PackagesResourceConfig.<init>(PackagesResourceConfig.java:89)
    com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:700)
    com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:678)
    com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:203)
    com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:374)
    com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:557)
    javax.servlet.GenericServlet.init(GenericServlet.java:160)
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
    org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
    java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    java.lang.Thread.run(Unknown Source)

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

我包括了所有的罐子,但我仍然无法达到错误点。

4

2 回答 2

1

如果其他人遇到相同的 pb,我刚刚找到了答案:我从捆绑包中安装了球衣。但是该捆绑包缺少 asm lib。所以我下载了包含 asm lib 的 zip jersey,它可以工作。:)

于 2013-07-01T23:38:31.350 回答
0

我也收到与ClassVisitorASM 库相关的相同错误。

我通过添加asm-3.1.jar可从此 链接获得的 jersey 1.17.1 版本找到了解决方案。

这为我解决了上述错误。

于 2013-07-18T10:38:37.620 回答