NoSuchMethodError when accessing a web application resource on a Tomcat server

After searching the Internet, this is a question that I could not find the answer to. My web application is deployed on a tomcat server, I know that everything works as index.jsp displays the text. but when I try to access a resource that I did to print the world hi, the tomcat server returns this message

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 anyone have any ideas or clues as to why this is happening, which will help me in resolving this issue?

Any help greatly appreciated thanks to Chris

+3
source share
3 answers

, - . , WEB-INF/lib

+3

jersey jars WEB-INF/lib

  • - 1.3.jar
  • ASM-3.1.jar
  • --1.3.jar
  • --1.3.jar
+2

, jersey-server jersey-core ( , WEB-INF/lib ).

In my case, we ran into our version of the jersey-client that came across a jersey-core version (dependency) or something like that, while we called up a specific (older) version of the jersey server, a mismatch (old jersey server , new jersey core).

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 so.

0
source

Source: https://habr.com/ru/post/1776687/


All Articles