0

I have two tomcat servers and the web application works fine on one while the other server gives the following error. I have deployed on Tomcat 7 and it works fine. When the webapp was deployed to another server with Tomcat 6, there were errors similar to the above mentioned error. Is there a chance that the version of tomcat is the problem? How do I make my web-app independent of tomcat version?

SEVERE: Allocate exception for servlet AtmosphereServlet com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes. at com.sun.jersey.server.impl.application.RootResourceUriRules.(RootResourceUriRules.java:99) at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1308) at com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:171) at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:777) at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:773) at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193) at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:773) at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:768) at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:488) at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:318) at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:607) at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:208) at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:373) at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:556) at javax.servlet.GenericServlet.init(GenericServlet.java:212) at org.atmosphere.util.AtmosphereFilterChain.init(AtmosphereFilterChain.java:125) at org.atmosphere.handler.ReflectorServletProcessor$FilterChainServletWrapper.init(ReflectorServletProcessor.java:294) at org.atmosphere.handler.ReflectorServletProcessor.init(ReflectorServletProcessor.java:185) at org.atmosphere.cpr.AtmosphereFramework.initAtmosphereHandler(AtmosphereFramework.java:912)

My web.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:j2ee="http://java.sun.com/xml/ns/javaee"
    xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2.5.xsd"
    version="2.5">
  <context-param>
    <param-name>port</param-name>
    <param-value>8080</param-value>
  </context-param>
  <context-param>
    <param-name>authenticate</param-name>
    <param-value>false</param-value>
  </context-param>
  <context-param>
    <param-name>url</param-name>
    <param-value>urlxxx</param-value>
  </context-param>
  <context-param>
    <param-name>log4j-config</param-name>
    <param-value>WEB-INF/log4j.xml</param-value>
  </context-param>
  <listener>
    <listener-class>web.ServletInit</listener-class>
  </listener>
  <description>api</description>
  <display-name>api</display-name>
  <servlet>
    <servlet-name>Bootstrap</servlet-name>
    <servlet-class>web.Bootstrap</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet>
    <description>AtmosphereServlet</description>
    <servlet-name>AtmosphereServlet</servlet-name>
    <servlet-class>org.atmosphere.cpr.AtmosphereServlet</servlet-class>
    <init-param>
      <param-name>com.sun.jersey.config.property.packages</param-name>
      <param-value>v0;com.wordnik.swagger.jaxrs.listing;web</param-value>
    </init-param>
    <init-param>
      <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
      <param-value>true</param-value>
    </init-param>
    <init-param>
      <param-name>com.sun.jersey.config.property.packages</param-name>
      <param-value>org.atmosphere.samples.chat.jersey</param-value>
    </init-param>
    <init-param>
      <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
      <param-value>web.OAuthAuthenticationFilter;web.MediaTypeFilter</param-value>
    </init-param>
    <init-param>
      <param-name>com.sun.jersey.config.feature.DisableWADL</param-name>
      <param-value>true</param-value>
    </init-param>
    <init-param>
      <param-name>swagger.api.basepath</param-name>
      <param-value>/mws/0/</param-value>
    </init-param>
    <init-param>
      <param-name>api.version</param-name>
      <param-value>0.0</param-value>
    </init-param>
    <async-supported>true</async-supported>
  </servlet>
  <servlet-mapping>
    <servlet-name>AtmosphereServlet</servlet-name>
    <url-pattern>/0/*</url-pattern>
  </servlet-mapping>
</web-app>

I also saw the catalina logs say "Parse error in application web.xml file at jndi:/localhost/WEB-INF/web.xml com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence."

  • Does this solve it? http://stackoverflow.com/questions/4412147/the-resourceconfig-instance-does-not-contain-any-root-resource-classes – developerwjk Sep 23 '14 at 23:06
  • This is just a guess. But, what is the 'v0;'?? – Alejandro Diaz Sep 24 '14 at 00:02
  • v0 is the package name that has all the resources – user2394774 Sep 24 '14 at 12:59
  • @developerwjk I saw that my root resource had a path "/xxx" when the url-pattern is /0/*. So I got rid of the slash in the front in the path of my root resource but I still get the same error. I tried several things mentioned there but no use so far. – user2394774 Sep 24 '14 at 14:34

0 Answers0