我有两个tomcat服务器,Web应用程序在一个上工作正常,而另一个服务器出现以下错误。我已经部署在Tomcat 7上,它运行正常。当使用Tomcat 6将webapp部署到另一台服务器时,会出现类似于上述错误的错误。 tomcat的版本是否有可能出现问题?如何使我的网络应用程序独立于tomcat版本?
SEVERE:为servlet AtmosphereServlet分配异常 com.sun.jersey.api.container.ContainerException:ResourceConfig实例不包含任何根资源类。 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) 在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) 在com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:488) at com.sun.jersey.spi.container.servlet.ServletContainer $ InternalWebComponent.initiate(ServletContainer.java:318) 在com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:607) 在com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:208) 在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.atmosphere.util.AtmosphereFilterChain.init(AtmosphereFilterChain.java:125) 在org.atmosphere.handler.ReflectorServletProcessor $ FilterChainServletWrapper.init(ReflectorServletProcessor.java:294) 在org.atmosphere.handler.ReflectorServletProcessor.init(ReflectorServletProcessor.java:185) 在org.atmosphere.cpr.AtmosphereFramework.initAtmosphereHandler(AtmosphereFramework.java:912)
我的web.xml如下所示:
<?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>
我还看到catalina日志说“jndi:/lhosthost/WEB-INF/web.xml中应用程序web.xml文件中的解析错误 com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException:1字节UTF-8序列的字节1无效。“