我在运行代码时遇到问题。每次我运行我的代码时,服务器都会抛出此错误,我检查了我添加的每个jar都正确,还检查了jdk
和jre
路径,但我无法解决问题。
2017年8月7日下午2:59:57 org.apache.catalina.startup.HostConfig deployDescriptor 严重:部署配置描述符C:\ Program Files \ Apache Software Foundation \ Tomcat 8.0 \ conf \ Catalina \ localhost \ helloworldspring.xml时出错 java.lang.IllegalStateException:ContainerBase.addChild:start:org.apache.catalina.LifecycleException:无法启动组件[StandardEngine [Catalina] .StandardHost [localhost] .StandardContext [/ helloworldspring]] 在org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:729) 在org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701) 在org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) 在org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:586) 在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) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617) 在java.lang.Thread.run(Thread.java:745)
2017年8月7日下午2:59:57 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>
和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" 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>
答案 0 :(得分:0)
详细检查异常,尤其是“由...引起”部分。它绝对可以帮助您找到原因。
此外,如果您使用的是maven,请查看maven依赖关系树,如果有任何不同版本的jar文件,尤其是 servlet jar 。
如果在windows上,将“-verbose”添加到tomcat“bin / wrapper.conf”中的JVM_OPTS列表中 的 wrapper.java.additional.11 = “ - 详细”即可。这将帮助您找到根本原因
答案 1 :(得分:0)
我有同样的问题,
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文件,它运行正常。