[英]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
文件夹中包含以下球衣罐
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.