Java org.apache.catalina.LifecycleException: 无法启动组件 [StandardServer[8005]] 子容器在启动过程中失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28753473/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]A child container failed during start
提问by Shirgill Farhan
I am struggling for the past 6-7 hrs trying to figure out what went wrong with my Apache Tomcat Server. In all of my projects, the jdk
version got switched to 1.6
from 1.8
.
在过去的 6-7 个小时里,我一直在努力找出我的 Apache Tomcat 服务器出了什么问题。在我所有的项目中,jdk
版本都1.6
从1.8
.
To solve the version conflict
, I verified whether compiled version and JVM of Tomcat version are same by taking help from here.
为了解决这个问题version conflict
,我通过这里的帮助验证了编译版本和Tomcat版本的JVM是否相同。
For multiple contexts with the same path error, I know i need to remove duplicate Context tags in server.xml
. So, first I check in Servers project (which gets created itself when you add Apache Tomcat Server in Eclipse) and find none there. So, I delve deep into the directory(Eclipse WorkSpace) metadata\.plugins\org.eclipse.wst.server.core\tmp3\conf
and removed the duplicate Context tags over there, with help taken from here.
对于具有相同路径错误的多个上下文,我知道我需要删除server.xml
. 因此,首先我检查 Servers 项目(当您在 Eclipse 中添加 Apache Tomcat Server 时它会自行创建)并且在那里找不到。因此,我深入研究了该目录(Eclipse WorkSpace),metadata\.plugins\org.eclipse.wst.server.core\tmp3\conf
并在从此处获取帮助的情况下删除了那里的重复上下文标记。
Now when i create a new Dynamic Web Project, everything works fine and I am able to see the web page. But if I try to access any of the HTML, XHTML files of those old project in which the jdk got changed, this org.apache.catalina.LifecycleException
continues to pop up and the server fails to start, and consequently these duplicate Context tags continues to build up again and again every time i start the server.
现在,当我创建一个新的动态 Web 项目时,一切正常,我可以看到网页。但是,如果我尝试访问那些更改了 jdk 的旧项目的任何 HTML、XHTML 文件,则会org.apache.catalina.LifecycleException
继续弹出并且服务器无法启动,因此这些重复的 Context 标记会继续一次又一次地建立起来我启动服务器的时间。
None of my old Web application projects seems to work now.
我的旧 Web 应用程序项目现在似乎都不起作用了。
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext [/EdBurns_ChrisSchalk]]..... SEVERE: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]] .... Caused by: java.lang.RuntimeException: Unexpected element value kind in annotation: 0
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: 无法启动组件 [StandardEngine[Catalina].StandardHost[localhost].StandardContext [/EdBurns_ChrisSchalk]]..... 严重:启动期间子容器失败java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: 无法启动组件 [StandardEngine[Catalina].StandardHost[localhost]] .... 由:java.lang.RuntimeException: 注释中的意外元素值种类: 0
How to prevent these context tagsbeing build up again and again in server.xml. Secondly, how to get back those old web projects to working state again?
如何防止这些上下文标记在server.xml 中一次又一次地构建。其次,如何让那些旧的 web 项目重新回到工作状态?
采纳答案by Shirgill Farhan
This will prevent multiple context tags to be created upon each request
这将防止在每个请求时创建多个上下文标签
1)Stop the server
2)Clean Tomcat's work directory
1)停止服务器
2)清理 Tomcat 的工作目录
回答by Nirav Majevadiya
If you are not using annotation based Servlet then please remove annotation @WebServlet("/YourServletName")from the starting of the servlet. This annotation confuses the mapping with web.xml, after removing this annotation Tomcat server will work properly.
如果您没有使用基于注解的 Servlet,那么请 从 Servlet 的开头删除注解@WebServlet("/YourServletName")。这个注解混淆了web.xml的映射,去掉这个注解后Tomcat服务器就可以正常工作了。
回答by ShreyJo10
Go to the task manager, kill the java processes and turn the server back on. should work fine.
转到任务管理器,杀死 java 进程并重新打开服务器。应该工作正常。
回答by Taleev Aalam
Went through the various resources on the net but none of them helped then i deleted the existing server and added the same server again and now it is working fine and the steps are
浏览了网上的各种资源,但都没有帮助,然后我删除了现有的服务器并再次添加了相同的服务器,现在它工作正常,步骤是
Window>>ShowView>>Servers>>RightClick>>Delete
窗口>>显示视图>>服务器>>右键单击>>删除
and then add the server again as you have added previously.
然后像您之前添加的那样再次添加服务器。
回答by Shivaramakrishna Agapu
I think it is jar file version problem. I had the same issue and I fixed it by changing the commons-codec-1.6.jar file from the build path. Earlier I was using latest version 1.10. Gradually I decreased the versions and 1.6 version fixed my issue.
我认为这是jar文件版本问题。我遇到了同样的问题,我通过更改构建路径中的 commons-codec-1.6.jar 文件来修复它。早些时候我使用的是最新版本 1.10。渐渐地,我减少了版本,1.6 版本修复了我的问题。
回答by sofian
I had a similar error and fixed it by following steps: 1. Under Servers project (which gets created itself when you add Apache Tomcat Server in Eclipse), open server.xml 2. Comment out the line
我有一个类似的错误并通过以下步骤修复它: 1. 在 Servers 项目下(当您在 Eclipse 中添加 Apache Tomcat Server 时它会自行创建),打开 server.xml 2. 注释掉该行
<Context docBase=... />
回答by TheCodeBear
In my case, the servlet-api.jar file in jre/lib/ext in the jdk directory conflicts with the servlet-api.jar file in tomcat, removing the servlet-api.jar in jre/lib/ext in the jdk directory can solve the problem.
我的情况是jdk目录下jre/lib/ext中的servlet-api.jar文件与tomcat中的servlet-api.jar文件冲突,去掉jdk目录下jre/lib/ext中的servlet-api.jar可以解决问题。
回答by Jagadeesh Sali
This seems to be an issue with local Maven repository. (i.e. .m2 folder) may be due to some corrupt .jar file
这似乎是本地 Maven 存储库的问题。(即 .m2 文件夹)可能是由于一些损坏的 .jar 文件
For me, the following actions helped to overcome this issue.
对我来说,以下行动有助于克服这个问题。
On my local file system, I've deleted the directory .m2(Maven local repository)
In Eclipse, updated the project (select Maven > Update Project)
Ran the app again on Tomcat server.
在我的本地文件系统上,我删除了目录 .m2(Maven 本地存储库)
在Eclipse 中,更新项目(选择Maven > Update Project)
在 Tomcat 服务器上再次运行该应用程序。
回答by RAHUL KUMAR
Just make sure build with correct web.xml configuration.I have update web.xml with tomcat configuration and it worked for me.Sample :-
只需确保使用正确的 web.xml 配置构建。我使用 tomcat 配置更新了 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:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>simulator</display-name>
<description>simulator app</description>
<!-- File upload -->
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<!-- excel simulation -->
<display-name>simulator</display-name>
<description>simulator app</description>
<!-- File upload -->
<welcome-file-list>
<welcome-file>InsertPage.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>FileUploadServlet</servlet-name>
<servlet-class>clari5.excel.FileUploadServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>FileUploadServlet</servlet-name>
<url-pattern>/excelSimulator/FileUploadServlet</url-pattern>
</servlet-mapping>
</web-app>
回答by Rafael Fernandes Vieira
One of the problems that can cause this is when you forget to put the / character in the WebServlet annotation @WebServlet("/example") @WebServlet("example") I hope it works, it worked for me.
可能导致这种情况的问题之一是当您忘记将 / 字符放在 WebServlet 注释中时 @WebServlet("/example") @WebServlet("example") 我希望它有效,它对我有用。