我在运行代码时遇到问题。每次我运行代码时,服务器都会抛出此错误,我检查了我添加的每个 jar 是否正确,还检查了jdk
和jre
路径,但我无法解决问题。
Aug 07, 2017 2:59:57 PM org.apache.catalina.startup.HostConfig deployDescriptor SEVERE:部署配置描述符 C:\Program Files\Apache Software Foundation\Tomcat 8.0\conf\Catalina\localhost\helloworldspring.xml java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].标准主机[本地主机]。StandardContext[/helloworldspring]] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:729( at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701( at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717( at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:586( at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1750( at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511( at java.util.concurrent.FutureTask.run(FutureTask.java:266( at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142( at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617( at java.lang.Thread.run(Thread.java:745(
Aug 07, 2017 2:59:57 PM org.apache.catalina.startup.HostConfig deployDescriptor
调度程序-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">
<context:component-scan base-package="com.myspring.controller"></context:component-scan>
<mvc:annotation-driven/>
<bean id ="viewResolver" class ="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefiex" value = "/WEB-INF/pages"></property>
<property name="suffix" value=".jsp"></property>
</bean>
</beans>
和网络.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" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>helloworldspring</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
详细检查异常,尤其是"原因"部分。它绝对可以帮助您找到原因。
另外,如果您使用的是 maven,请检查 maven 依赖树中是否有任何不同版本的 jar 文件,尤其是servlet jar。
如果在 Windows 上,将 "-verbose 添加到 tomcat "bin/wrapper.conf" 中的JVM_OPTS列表中wrapper.java.additional.11="-verbose"。这将帮助您找到根本原因
我有同样的问题,比如,
14-May-2018 19:12:40.190 INFO [localhost-startStop-2] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor /home/chandrakant/apache-tomcat-8.0.48/conf/Catalina/localhost/sbic.xml
14-May-2018 19:12:40.192 SEVERE [localhost-startStop-2] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/sbic]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:620)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1832)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot@55c9a2a4]
我已经通过从 apache/conf/Catalina/localhost 中删除除 web 之外的所有 xml 文件来解决它.xml并且它工作正常。