Java 严重:ContainerBase.addChild:start:org.apache.catalina.LifecycleException:无法启动错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21039049/
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
SEVERE: ContainerBase.addChild: start:org.apache.catalina.LifecycleException: Failed to start error
提问by james goooseling
I encountered this error when I tried to run my application in Tomcat. I already checked the version of tomcat and java home. Both use java 6.
当我尝试在 Tomcat 中运行我的应用程序时遇到了这个错误。我已经检查了tomcat和java home的版本。两者都使用java 6。
Is there a missing jar? Or is it my web xml? I'm not using any maven tool.
有没有丢失的罐子?还是我的 web xml?我没有使用任何 Maven 工具。
SEVERE: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ICard]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:650)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1582)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: javax/xml/rpc/handler/soap/SOAPMessageContext
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2904)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1173)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1681)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getDeclaredMethods(Unknown Source)
at org.apache.catalina.util.Introspection.getDeclaredMethods(Introspection.java:108)
at org.apache.catalina.startup.WebAnnotationSet.loadMethodsAnnotation(WebAnnotationSet.java:279)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:141)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:67)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:405)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5173)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 11 more
Caused by: java.lang.ClassNotFoundException: javax.xml.rpc.handler.soap.SOAPMessageContext
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
... 33 more
Jan 10, 2014 4:05:06 PM org.apache.catalina.startup.HostConfig deployDescriptor
SEVERE: Error deploying configuration descriptor F:\RCBC\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\conf\Catalina\localhost\ICard.xml
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ICard]]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:904)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:650)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1582)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Jan 10, 2014 4:05:06 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8100"]
Jan 10, 2014 4:05:06 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jan 10, 2014 4:05:06 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 4003 ms
回答by james goooseling
Got the solution for this problem.... Wooo
得到了这个问题的解决方案....呜呜
Make sure that Appliction server (Tomcat etc.) uses the same java runtime version as per what your java application is using.
Make sure that your using jre path not jdk path for the runtime enviroments
Make sure when creating a project select the appropriate server runtime versions.
确保应用程序服务器(Tomcat 等)根据您的 Java 应用程序使用的 Java 运行时版本使用相同的 Java 运行时版本。
确保您使用的 jre 路径不是运行时环境的 jdk 路径
确保在创建项目时选择适当的服务器运行时版本。
回答by swapyonubuntu
Weird error, you can try methods given by james goooseling and also I have done it by following ways:
奇怪的错误,您可以尝试 james goooseling 给出的方法,我也通过以下方式完成:
Remove all jars or libraries from build path and lib folders and add them again in lib folder or build path as you wish.
Check if you have servlet annotation
@WebServlet
for given servlet and if it has mapping in web.xml as well .. this is most common error due to which tomcat gets confused , that what url pattern must he use.
从构建路径和 lib 文件夹中删除所有 jar 或库,然后根据需要将它们再次添加到 lib 文件夹或构建路径中。
检查您是否有
@WebServlet
给定 servlet 的servlet 注释,以及它是否在 web.xml 中也有映射......这是最常见的错误,因为 tomcat 会混淆,他必须使用什么 url 模式。
回答by Mahesh C.
According to me, this would happen if there are two offending classes of same name but with different version. Usually, it happens due to servlet-api.jar. If its present in lib folder of your war, then pls remove it using whichever tool used for building war. Or in case of maven, add the dependency with scope specified as "provided". This will solve the compilation issue and at run time it will refer to jar provided by server environment. Pls configure the dependency as follows:
根据我的说法,如果有两个同名但版本不同的违规类,就会发生这种情况。通常,它是由于 servlet-api.jar 而发生的。如果它存在于您的战争的 lib 文件夹中,那么请使用用于构建战争的任何工具将其删除。或者在 maven 的情况下,添加范围指定为“提供”的依赖项。这将解决编译问题,并且在运行时它将引用服务器环境提供的 jar。请按如下方式配置依赖项:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
回答by Atul
Please verify your .project and .classpath files. Verify the java version and other reuqired details. If those and missing or mis matched
请验证您的 .project 和 .classpath 文件。验证 java 版本和其他需要的详细信息。如果那些和缺失或不匹配
回答by Nielsvh
I'm not sure what happened in your case that fixed the issue, but your issue was on this line:
我不确定在您的情况下发生了什么解决了该问题,但您的问题出在这一行:
Caused by: java.lang.NoClassDefFoundError: javax/xml/rpc/handler/soap/SOAPMessageContext
You need to add jaxrpc-api.jar
to your /lib
s or add
您需要添加jaxrpc-api.jar
到您的/lib
s 或添加
<dependency>
<groupId>javax.xml</groupId>
<artifactId>jaxrpc-api</artifactId>
<version>x.x.x</version>
</dependency>
to your maven dependencies.
到您的 Maven 依赖项。
回答by Alan
I had the same error statement following a "Failed to access resource"error message:
在“无法访问资源”错误消息之后,我有相同的错误语句:
Command
命令
#cat callflow-java-logger-1.log.0
Output
输出
Dec 09, 2015 8:09:03 AM org.apache.catalina.loader.WebappLoader startInternal
SEVERE: LifecycleException
java.io.IOException: Failed to access resource /WEB-INF/lib/ojdbc14.jar
In my case the solution was changing the connector permissions
在我的情况下,解决方案是更改连接器权限
-rw------- 1 owner creator size date ojdbc14.jar
This file in question wasn't initially located at /WEB-INF/lib, which was probably due to how BIRT works. It can be tricky if you are dealing with a higher number of files.
这个有问题的文件最初并不位于 /WEB-INF/lib,这可能是由于 BIRT 的工作方式。如果您处理的文件数量较多,这可能会很棘手。
回答by nkharche
This issue arises because of different reasons. It might encountered if you are using Spring boot built war file. As Spring boot web and rest starter projects jars do have embedded Tomcat in it, hence fails with "SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException".
出现此问题的原因各不相同。如果您使用 Spring boot 构建的 war 文件,可能会遇到它。由于 Spring boot web 和 rest starter 项目 jar 确实在其中嵌入了 Tomcat,因此失败并显示“SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException”。
You can fix this by exclusion of the embedded tomcat at the time of packaging by using exclusionsin case of maven.
您可以通过在 maven 的情况下使用排除在打包时排除嵌入的 tomcat 来解决此问题。
Maven dependency of "spring-boot-starter-web" will look like
“spring-boot-starter-web”的Maven依赖看起来像
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
回答by gabrielkerekes
What caused this error in my case was having two @GET methods with the same path in a single resource. Changing the @Path of one of the methods solved it for me.
在我的情况下导致此错误的原因是在单个资源中有两个具有相同路径的 @GET 方法。更改其中一种方法的@Path 为我解决了这个问题。
回答by vts
In my case the servlet name defined in the web.xml was not same as the sevlet name in the servlet mapping tag. I have corrected this and the WAR was deployed successfully.
在我的例子中,web.xml 中定义的 servlet 名称与 servlet 映射标记中的 sevlet 名称不同。我已经更正了这一点,并且成功部署了 WAR。
回答by fonxian
Main reason:SOAPMessageContext NoClassDefFoundError So you need import this Class or jar
主要原因:SOAPMessageContext NoClassDefFoundError 所以需要导入这个Class或者jar
in IDEA
在想法
- ctrl+shift+alt+S,“Libraries”,find the absent class.
- edit the local Maven config.
- ctrl+ shift+ alt+ S,“图书馆”,找到缺席的课程。
- 编辑本地 Maven 配置。
.m2/repository/your absent class(for example commons-logging)/.../maven-metadata-central.xml
.m2/repository/你缺席的类(例如 commons-logging)/.../maven-metadata-central.xml
<?xml version="1.0" encoding="UTF-8"?>
<metadata modelVersion="1.1.0">
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<versioning>
<latest>1.2</latest>
<release>1.2</release>
<versions>
<version>1.0</version>
<version>1.0.1</version>
<version>1.0.2</version>
<version>1.0.3</version>
<version>1.0.4</version>
<version>1.1</version>
<version>1.1.1</version>
<version>1.1.2</version>
<version>1.1.3</version>
<version>1.2</version>
</versions>
<lastUpdated>20140709195742</lastUpdated>
</versioning>
</metadata>
<latest>your need absend class version and useful</latest>
because Maven will find 'metadata-central.xml' config lastest version as project use version.
因为 Maven 会找到 'metadata-central.xml' 配置最新版本作为项目使用版本。
forgive my chinese english:)
原谅我的中文英语:)