简体   繁体   English

访问Tomcat服务器上的Web应用程序资源时出现NoSuchMethodError

[英]NoSuchMethodError when accessing web app resource on Tomcat server

After searching online this is a question I have been unable to find an answer for. 在线搜索后,这是一个我无法找到答案的问题。 My Web Application is deployed to the tomcat server i know this is all working as the index.jsp displays the text. 我的Web应用程序部署到tomcat服务器,我知道这一切都在作为index.jsp显示文本。 but when i try to access the resource i have made that should print out hello world the tomcat server returns this message 但是当我尝试访问我已经创建的资源应该打印出hello world时,tomcat服务器返回此消息

java.lang.NoSuchMethodError: com.sun.jersey.core.spi.component.ProviderServices.<init>(Lcom/sun/jersey/core/spi/factory/InjectableProviderFactory;Lcom/sun/jersey/core/spi/component/ProviderFactory;Ljava/util/Set;Ljava/util/Set;)V
    com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:450)
    com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:383)
    com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:377)
    com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:242)
    com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:449)
    com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:169)
    com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:281)
    com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:442)
    javax.servlet.GenericServlet.init(GenericServlet.java:212)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    java.lang.Thread.run(Unknown Source)

Does any one have any ideas or clues as to why this is happening that will aid me in solving this? 有没有人有任何想法或线索,为什么会发生这种情况会帮助我解决这个问题?

Any help greatly appreciated Thanks Chris 任何帮助非常感谢谢谢克里斯

My guess is that there is something wrong with tha jars in your classpath. 我的猜测是你的类路径中存在一些问题。 Probably, you may have two different versions of jersey on your classpath or in WEB-INF/lib 也许,您可能在类路径或WEB-INF / lib中有两个不同版本的jersey

you must be include the following jersey jars into your WEB-INF/lib folder 您必须在WEB-INF/lib文件夹中包含以下球衣罐

  • jersey-server-1.3.jar 新泽西服务器1.3.jar
  • asm-3.1.jar ASM-3.1.jar
  • jersey-core-1.3.jar 球衣核心 - 1.3.jar
  • jersey-client-1.3.jar 新泽西州的客户 - 1.3.jar

I believe this is caused by a difference in version between "jersey-server" and "jersey-core" jars (also double check you don't accidentally have duplicate difference versions of those various jars in your WEB-INF/lib folder). 我相信这是由于“jersey-server”和“jersey-core”罐子之间的版本差异造成的(同样要仔细检查你不会在WEB-INF / lib文件夹中偶然发现那些不同罐子的重复差异版本)。

In my case we had bumped our jersey-client version, which had bumped the jersey-core version (a dependency), or something like that, whereas we called out a particular (older) jersey-server version, thus causing a mismatch (old jersey-server 1.0.2, new jersey-core 1.11). 在我的情况下,我们已经碰到了我们的泽西 - 客户端版本,这已经碰到了jersey-core版本(一个依赖项),或类似的东西,而我们调出了一个特定的(旧的)泽西服务器版本,从而导致不匹配(旧jersey-server 1.0.2,new jersey-core 1.11)。

Also

SEVERE: The provider class, class com.sun.jersey.core.impl.provider.xml.XMLStreamReaderContextProvider, could not be instantiated
Caused by: java.lang.NullPointerException
        at com.sun.jersey.core.impl.provider.xml.TransformerFactoryProvider.<init>(TransformerFactoryProvider.java:57)
        ... 44 more

I think same. 我想也一样。

Also if jersey-core is at 1.0.2 and jersey-client is 1.11 same ProviderServices failiure. 此外,如果jersey-core为1.0.2且jersey-client为1.11,则ProviderServices失败。

Fix: make them all match. 修复:让它们全部匹配。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Tomcat 7中访问Jersey应用程序时出现404 - 404 when accessing Jersey app in Tomcat 7 当应用程序在 spring 启动应用程序中的服务器上运行时访问资源文件夹中的文件 - Accessing files in the resource folder when the app is running on the server in a spring boot app 部署到tomcat后访问资源文件时出现FileNotFoundException - FileNotFoundException when accessing a resource file after deploy to tomcat java TCP 服务器内部 Tomcat Z2567A5EC9705EB7AC2C984033E0618D - java TCP Server inside Tomcat web app 在远程服务器上加载Web应用程序(Tomcat上的Servlet) - Load web app (servlet on Tomcat) in a remote server 资源URI在tomcat 8服务器上的Java RESTful Web服务中不起作用 - Resource URIs not working in Java RESTful web service on tomcat 8 server Tomcat服务器测试SOAP服务NoSuchMethodError - Tomcat Server to test SOAP service NoSuchMethodError 访问Tomcat Web Manager时连接超时 - Connection timmed out when accessing Tomcat web manager 使用Jersey和Tomcat访问Java中的Web服务时出现404 - 404 when accessing Web Service in java using Jersey and Tomcat 支持Eclipse maven的Web应用程序引用工作区项目,但在运行Tomcat服务器时未部署这些项目 - Eclipse maven-enabled web app references workspace projects, but those are not deployed when running Tomcat server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM