无法仅使用基于代码的配置启动Spring Web App。得到错误:
INFO: validateJarFile(C:\Users\user1\Idea13 Projects\WebApp\target\WebApp-1.0-SNAPSHOT\WEB-INF\lib\javax.servlet-api-3.1.0.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Users\user1\Idea13 Projects\WebApp\target\WebApp-1.0-SNAPSHOT\WEB-INF\lib\tomcat-el-api-7.0.47.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Users\user1\Idea13 Projects\WebApp\target\WebApp-1.0-SNAPSHOT\WEB-INF\lib\tomcat-embed-core-7.0.47.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Users\user1\Idea13 Projects\WebApp\target\WebApp-1.0-SNAPSHOT\WEB-INF\lib\tomcat-servlet-api-7.0.47.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
org.apache.tomcat.util.digester.Digester endElement
SEVERE: End event threw exception
java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addServlet
.........
org.apache.catalina.startup.ContextConfig parseWebXml
SEVERE: Parse error in application web.xml file at file:/C:/Users/user1/.IntelliJIdea13/system/tomcat/Unnamed_WebApp/conf/web.xml
org.xml.sax.SAXParseException; systemId: file:/C:/Users/user1/.IntelliJIdea13/system/tomcat/Unnamed_WebApp/conf/web.xml; lineNumber: 104; columnNumber: 13; Error at (104, 13) : org.apache.catalina.deploy.WebXml addServlet
...
Caused by: java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addServlet
org.apache.catalina.startup.ContextConfig parseWebXml
SEVERE: Occurred at line 104 column 13
org.apache.catalina.deploy.WebXml setVersion
WARNING: Unknown version string [3.1]. Default version will be used.
org.apache.catalina.startup.ContextConfig configureStart
SEVERE: Marking this application unavailable due to previous error(s)
org.apache.catalina.core.StandardContext startInternal
SEVERE: Error getConfigured
org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [] startup failed due to previous errors
据我所知它指向web.xml
,但我不使用它。如何解决?
更新
从部署路径中删除catalina*
后,我得到了:
SEVERE: Servlet.service() for servlet [jsp] in context with path [] threw exception [java.lang.ClassCastException: org.apache.catalina.core.DefaultInstanceManager cannot be cast to org.apache.tomcat.InstanceManager] with root cause
java.lang.ClassCastException: org.apache.catalina.core.DefaultInstanceManager cannot be cast to org.apache.tomcat.InstanceManager
解决
答案 0 :(得分:1)
严重:在应用程序web.xml文件中解析错误 文件:/ C:/Users/user1/.IntelliJIdea13/system/tomcat/Unnamed_WebApp/conf/web.xml org.xml.sax.SAXParseException;的systenId: 文件:/ C:/Users/user1/.IntelliJIdea13/system/tomcat/Unnamed_WebApp/conf/web.xml;电话号码: 104; columnNumber:13; (104,13)出错:org.apache.catalina.deploy.WebXml addServlet 引起:java.lang.NoSuchMethodException:org.apache.catalina.deploy.WebXml addServlet
转到WEB-INf/lib
并删除catalina.*.jar
,然后重新启动tomcat。
或者maven项目提及其范围为provided
<scope>provided</scope>
注意:该解决方案是通用的,如果问题持续存在,请发布您的web.xml