同事们,你好。我知道这样的问题会在下一个线程(或它附近)中讨论: Maven war - Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/] building a maven war java.lang.ClassNotFoundException: HttpServletRequest How do I import the javax.servlet API in my Eclipse project? Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]] Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/JDBC_DBO]] 但他们无法帮助我。
因此,在Tomcat 7.0.61上从eclipse运行我的Web应用程序时遇到同样的问题:
严重:子容器在启动时失败 java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException:无法启动组件 [StandardEngine [卡塔利娜] .StandardHost [本地主机] .StandardContext [/假象-web的服务]
我的pom.xml看起来像:
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.mycomp.proj</groupId>
<artifactId>maya-proj</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>com.mycomp.proj</groupId>
<artifactId>maya-web-service</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>maya-web-service Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.2.10</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
<build>
<finalName>maya-web-service</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
</plugin>
</plugins>
</build>
</project>
&#34; mvn clean package &#34;下一个文件出现在目标文件夹中:
•maya-web-service.war maya-web-service \ index.jsp
•maya-web-service \ WEB-INF \ classes \ com \ mycomp \ proj \ MMayaServiceEndPoindImpl.java
•maya-web-service \ WEB-INF \ classes \ com \ mycomp \ proj \ MayaServiceInterface.java
•maya-web-service \ WEB-INF \ lib \ commons-beanutils-1.8.3.jar
•maya-web-service \ WEB-INF \ lib \ commons-digester-2.1.jar
•maya-web-service \ WEB-INF \ lib \ commons-logging-1.2.jar
•maya-web-service \ WEB-INF \ lib \ FastInfoset-1.2.13.jar
•maya-web-service \ WEB-INF \ lib \ gmbal-api-only-3.1.0-b001.jar
•maya-web-service \ WEB-INF \ lib \ ha-api-3.1.9.jar
•maya-web-service \ WEB-INF \ lib \ javax.annotation-api-1.2.jar
•maya-web-service \ WEB-INF \ lib \ javax.xml.soap-api-1.3.7.jar
•maya-web-service \ WEB-INF \ lib \ jaxb-api-2.2.12-b140109.1041.jar
•maya-web-service \ WEB-INF \ lib \ jaxb-core-2.2.10-b140802.1033.jar
•maya-web-service \ WEB-INF \ lib \ jaxb-impl-2.2.10-b140802.1033.jar
•maya-web-service \ WEB-INF \ lib \ jaxws-api-2.2.11.jar
•maya-web-service \ WEB-INF \ lib \ jaxws-rt-2.2.10.jar
•maya-web-service \ WEB-INF \ lib \ jsr181-api-1.0-MR1.jar
•maya-web-service \ WEB-INF \ lib \ management-api-3.0.0-b012.jar
•maya-web-service \ WEB-INF \ lib \ mimepull-1.9.4.jar
•maya-web-service \ WEB-INF \ lib \ policy-2.4.jar
•maya-web-service \ WEB-INF \ lib \ resolver-20050927.jar
•maya-web-service \ WEB-INF \ lib \ saaj-impl-1.3.25.jar
•maya-web-service \ WEB-INF \ lib \ stax2-api-3.1.1.jar
•maya-web-service \ WEB-INF \ lib \ stax-ex-1.7.7.jar
•maya-web-service \ WEB-INF \ lib \ streambuffer-1.5.3.jar
•maya-web-service \ WEB-INF \ lib \ woodstox-core-asl-4.2.0.jar
•maya-web-service \ WEB-INF \ sun-jaxws.xml
•maya-web-service \ WEB-INF \ web.xml
•classes \ com \ mycomp \ proj \ MayaServiceEndPoindImpl.java
•classes \ com \ mycomp \ proj \ MayaServiceInterface.java
•m2e-wtp \ web-resources \ META-INF \ MANIFEST.MF
•m2e-wtp \ web-resources \ META-INF \ maven \ com.mycomp.proj \ maya-web-service \ pom.properties
•m2e-wtp \ web-resources \ META-INF \ maven \ com.mycomp.proj \ maya-web-service \ pom.xml
•maven-archiver \ pom.properties
•maven-status \ maven-compiler-plugin \ compile \ default-compile \ inputFiles.lst
•maven-status \ maven-compiler-plugin \ testCompile \ default-testCompile \ inputFiles.lst
右键单击项目并选择&#34; 在服务器上运行&#34;我收到下一个登录控制台:
may 05, 2015 2:55:10 PM
> org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING:
> [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting
> property 'source' to 'org.eclipse.jst.j2ee.server:maya-web-service'
> did not find a matching property. may 05, 2015 2:55:10 PM
> org.apache.catalina.startup.VersionLoggerListener log INFO: Server
> version: Apache Tomcat/7.0.61 may 05, 2015 2:55:10 PM
> org.apache.catalina.startup.VersionLoggerListener log INFO: Server
> built: Mar 27 2015 12:03:56 UTC may 05, 2015 2:55:10 PM
> org.apache.catalina.startup.VersionLoggerListener log INFO: Server
> number: 7.0.61.0 may 05, 2015 2:55:10 PM
> org.apache.catalina.startup.VersionLoggerListener log INFO: OS Name:
> Windows 7 may 05, 2015 2:55:10 PM
> org.apache.catalina.startup.VersionLoggerListener log INFO: OS
> Version: 6.1 may 05, 2015 2:55:10 PM
> org.apache.catalina.startup.VersionLoggerListener log INFO:
> Architecture: amd64 may 05, 2015 2:55:10 PM
> org.apache.catalina.startup.VersionLoggerListener log INFO: Java Home:
> C:\Program Files\Java\jdk1.8.0_40\jre may 05, 2015 2:55:10 PM
> org.apache.catalina.startup.VersionLoggerListener log INFO: JVM
> Version: 1.8.0_40-b26 may 05, 2015 2:55:10 PM
> org.apache.catalina.startup.VersionLoggerListener log INFO: JVM
> Vendor: Oracle Corporation may 05, 2015 2:55:10 PM
> org.apache.catalina.startup.VersionLoggerListener log INFO:
> CATALINA_BASE: C:\Program Files\Apache Software
> Foundation\Tomcat 7.0 may 05, 2015 2:55:10 PM
> org.apache.catalina.startup.VersionLoggerListener log INFO:
> CATALINA_HOME: C:\Program Files\Apache Software
> Foundation\Tomcat 7.0 may 05, 2015 2:55:10 PM
> org.apache.catalina.startup.VersionLoggerListener log INFO: Command
> line argument: -Dcatalina.base=C:\Program Files\Apache Software
> Foundation\Tomcat 7.0 may 05, 2015 2:55:10 PM
> org.apache.catalina.startup.VersionLoggerListener log INFO: Command
> line argument: -Dcatalina.home=C:\Program Files\Apache Software
> Foundation\Tomcat 7.0 may 05, 2015 2:55:10 PM
> org.apache.catalina.startup.VersionLoggerListener log INFO: Command
> line argument: -Dwtp.deploy=C:\Program Files\Apache Software
> Foundation\Tomcat 7.0\webapps may 05, 2015 2:55:10 PM
> org.apache.catalina.startup.VersionLoggerListener log INFO: Command
> line argument: -Djava.endorsed.dirs=C:\Program Files\Apache Software
> Foundation\Tomcat 7.0\endorsed may 05, 2015 2:55:10 PM
> org.apache.catalina.startup.VersionLoggerListener log INFO: Command
> line argument: -Dfile.encoding=Cp1251 may 05, 2015 2:55:10 PM
> org.apache.catalina.core.AprLifecycleListener lifecycleEvent INFO: The
> APR based Apache Tomcat Native library which allows optimal
> performance in production environments was not found on the
> java.library.path: C:\Program
> Files\Java\jdk1.8.0_40\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program
> Files/Java/jre1.8.0_40/bin/server;C:/Program
> Files/Java/jre1.8.0_40/bin;C:/Program
> Files/Java/jre1.8.0_40/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Oracle_client\instantclient_11_2;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program
> Files\TortoiseSVN\bin;C:\Program Files (x86)\Microsoft SQL
> Server\110\Tools\Binn\ManagementStudio\;C:\Program Files
> (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft
> SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL
> Server\110\DTS\Binn\;C:\Program Files
> (x86)\Subversion\bin;C:\apache-maven-3.2.3\bin;C:\graphviz-2.38\release\bin;D:\Distr\eclipse-java-luna-SR1-win32-x86_64\eclipse;;.
> may 05, 2015 2:55:10 PM org.apache.coyote.AbstractProtocol init INFO:
> Initializing ProtocolHandler ["http-bio-8080"] may 05, 2015 2:55:10
> PM org.apache.coyote.AbstractProtocol init INFO: Initializing
> ProtocolHandler ["ajp-bio-8009"] may 05, 2015 2:55:10 PM
> org.apache.catalina.startup.Catalina load INFO: Initialization
> processed in 1057 ms may 05, 2015 2:55:10 PM
> org.apache.catalina.core.StandardService startInternal INFO: Starting
> service Catalina may 05, 2015 2:55:10 PM
> org.apache.catalina.core.StandardEngine startInternal INFO: Starting
> Servlet Engine: Apache Tomcat/7.0.61 may 05, 2015 2:55:11 PM
> org.apache.catalina.core.ContainerBase startInternal SEVERE: A child
> container failed during start java.util.concurrent.ExecutionException:
> org.apache.catalina.LifecycleException: Failed to start component
> [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/maya-web-service]]
> at java.util.concurrent.FutureTask.report(FutureTask.java:122) at
> java.util.concurrent.FutureTask.get(FutureTask.java:192) at
> org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
> at
> org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:819)
> at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> at
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
> at
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
> 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) Caused by:
> org.apache.catalina.LifecycleException: Failed to start component
> [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/maya-web-service]]
> at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
> ... 6 more Caused by: java.lang.NoClassDefFoundError:
> com/sun/istack/localization/Localizable at
> java.lang.ClassLoader.defineClass1(Native Method) at
> java.lang.ClassLoader.defineClass(ClassLoader.java:760) at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
> at
> org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2957)
> at
> org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1210)
> at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1690)
> at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
> at java.lang.ClassLoader.defineClass1(Native Method) at
> java.lang.ClassLoader.defineClass(ClassLoader.java:760) at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
> at
> org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2957)
> at
> org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1210)
> at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1690)
> at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
> at java.lang.Class.getDeclaredFields0(Native Method) at
> java.lang.Class.privateGetDeclaredFields(Class.java:2583) at
> java.lang.Class.getDeclaredFields(Class.java:1916) at
> org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106)
> at
> org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:270)
> at
> org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:89)
> at
> org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:63)
> at
> org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:415)
> at
> org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:892)
> at
> org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:386)
> at
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
> at
> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
> at
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5416)
> at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> ... 6 more Caused by: java.lang.ClassNotFoundException:
> com.sun.istack.localization.Localizable at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
> at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
> ... 34 more may 05, 2015 2:55:11 PM
> org.apache.catalina.core.ContainerBase startInternal SEVERE: A child
> container failed during start java.util.concurrent.ExecutionException:
> org.apache.catalina.LifecycleException: Failed to start component
> [StandardEngine[Catalina].StandardHost[localhost]] at
> java.util.concurrent.FutureTask.report(FutureTask.java:122) at
> java.util.concurrent.FutureTask.get(FutureTask.java:192) at
> org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
> at
> org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300)
> at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> at
> org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
> at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> at
> org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:739)
> at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> at org.apache.catalina.startup.Catalina.start(Catalina.java:689) at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:497) at
> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:321) at
> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455) Caused
> by: org.apache.catalina.LifecycleException: Failed to start component
> [StandardEngine[Catalina].StandardHost[localhost]] at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
> at
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
> at
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
> 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) Caused by:
> org.apache.catalina.LifecycleException: A child container failed
> during start at
> org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)
> at
> org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:819)
> at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> ... 6 more may 05, 2015 2:55:11 PM
> org.apache.catalina.startup.Catalina start SEVERE: The required Server
> component failed to start so Tomcat is unable to start.
> org.apache.catalina.LifecycleException: Failed to start component
> [StandardServer[8005]] at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
> at org.apache.catalina.startup.Catalina.start(Catalina.java:689) at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:497) at
> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:321) at
> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455) Caused
> by: org.apache.catalina.LifecycleException: Failed to start component
> [StandardService[Catalina]] at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
> at
> org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:739)
> at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> ... 7 more Caused by: org.apache.catalina.LifecycleException: Failed
> to start component [StandardEngine[Catalina]] at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
> at
> org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
> at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> ... 9 more Caused by: org.apache.catalina.LifecycleException: A child
> container failed during start at
> org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)
> at
> org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300)
> at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> ... 11 more may 05, 2015 2:55:11 PM
> org.apache.coyote.AbstractProtocol pause INFO: Pausing ProtocolHandler
> ["http-bio-8080"] may 05, 2015 2:55:11 PM
> org.apache.coyote.AbstractProtocol pause INFO: Pausing ProtocolHandler
> ["ajp-bio-8009"] may 05, 2015 2:55:11 PM
> org.apache.catalina.core.StandardService stopInternal INFO: Stopping
> service Catalina may 05, 2015 2:55:11 PM
> org.apache.coyote.AbstractProtocol destroy INFO: Destroying
> ProtocolHandler ["http-bio-8080"] may 05, 2015 2:55:11 PM
> org.apache.coyote.AbstractProtocol destroy INFO: Destroying
> ProtocolHandler ["ajp-bio-8009"]
如何在没有&#34的情况下运行Web应用程序;子容器在启动期间失败&#34;误?
答案 0 :(得分:2)
问题的根本原因是NoClassDefFound异常,这是由于缺少类com.sun.istack.localization.Localizable
。因此,您需要在项目的pom.xml中包含jaxb-core
或jaxb-impl
jar文件
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.11</version>
</dependency>
或添加此
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.2.11</version>
</dependency>
希望这能解决您的问题。