Tomcat exception

I go nuts trying to run a simple jersey - Spring webapp. The error I get from Tomcat when trying to access web resources:

HTTP Status 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 Spring Web Application threw exception 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:857) 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(Thread.java:619) root cause com.sun.jersey.api.container.ContainerException: No WebApplication provider is present com.sun.jersey.spi.container.WebApplicationFactory.createWebApplication(WebApplicationFactory.java:69) com.sun.jersey.spi.container.servlet.ServletContainer.create(ServletContainer.java:391) com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.create(ServletContainer.java:306) com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:607) com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:210) com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:373) com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:556) 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:857) 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(Thread.java:619) note The full stack trace of the root cause is available in the Apache Tomcat/6.0.28 logs. 

My web.xml is as follows:

 <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:application-context.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <listener> <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class> </listener> <servlet> <servlet-name>Jersey Spring Web Application</servlet-name> <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class> <init-param> <param-name>com.sun.jersey.config.property.packages</param-name> <param-value>com.companyname.abc</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Jersey Spring Web Application</servlet-name> <url-pattern>/webresources/*</url-pattern> </servlet-mapping> </web-app> 

Any ideas what I'm doing wrong?

+4
source share
3 answers

I had the same problem, and after some research and hacking that it had something to do with the hbase dependency, it became clear that the problem was caused by the fact that HBase imported jersey 1.4 when I used jersey 1.10 in my project. After eliminating jersey artifacts pulled out by HBase, everything seems like a fine atm:

  <dependency> <groupId>org.apache.hbase</groupId> <artifactId>hbase</artifactId> <version>0.90.4</version> <exclusions> <exclusion> <artifactId>jersey-core</artifactId> <groupId>com.sun.jersey</groupId> </exclusion> <exclusion> <artifactId>jersey-json</artifactId> <groupId>com.sun.jersey</groupId> </exclusion> <exclusion> <artifactId>jersey-server</artifactId> <groupId>com.sun.jersey</groupId> </exclusion> </exclusions> </dependency> 

hope this helps ..

+7
source

If you are just trying to get a basic example of work, this should not happen. Perhaps you have a corrupt drum pellet. Try deleting the existing one and upload a new one.

This error implies that your bank does not have the META-INF/services/com.sun.jersey.spi.container.WebApplicationProvider file, which tells it which WebApplicationProvider to use.

+3
source

In my case

mvn dependency:tree

revealed that a different version of the jersey server was used. I turned on version 1.12, but in the tree that appears

com.sun.jersey: jersey server: bank: 1.9-ea07: compile

After fixing this strange dependency, the error disappeared.

+1
source

All Articles