问题:在同事那里拿了一个Eclipse的maven项目,导入报错,主要显示的是A child container failed during start
具体错误如下
六月 02, 2018 12:08:50 下午 org.apache.tomcat.util.digester.SetPropertiesRule begin 警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source‘ to ‘org.eclipse.jst.jee.server:UcomWechat‘ did not find a matching property. 六月 02, 2018 12:08:50 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server version: Apache Tomcat/9.0.0.M17 六月 02, 2018 12:08:50 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server built: Jan 10 2017 20:59:20 UTC 六月 02, 2018 12:08:50 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server number: 9.0.0.0 六月 02, 2018 12:08:50 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: OS Name: Windows 10 六月 02, 2018 12:08:50 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: OS Version: 10.0 六月 02, 2018 12:08:50 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Architecture: amd64 六月 02, 2018 12:08:50 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Java Home: D:\Program Files\Java\jdk1.8.0_121\jre 六月 02, 2018 12:08:50 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: JVM Version: 1.8.0_121-b13 六月 02, 2018 12:08:50 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: JVM Vendor: Oracle Corporation 六月 02, 2018 12:08:50 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: CATALINA_BASE: D:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1 六月 02, 2018 12:08:50 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: CATALINA_HOME: D:\Tomcat 9.0 六月 02, 2018 12:08:50 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dcatalina.base=D:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1 六月 02, 2018 12:08:50 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dcatalina.home=D:\Tomcat 9.0 六月 02, 2018 12:08:50 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dwtp.deploy=D:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps 六月 02, 2018 12:08:50 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Djava.endorsed.dirs=D:\Tomcat 9.0\endorsed 六月 02, 2018 12:08:50 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dfile.encoding=GBK 六月 02, 2018 12:08:50 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent 信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Program Files\Java\jdk1.8.0_121\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;D:\Python\Python36\Scripts\;D:\Python\Python36\;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;;C:\Program Files (x86)\SSH Communications Security\SSH Secure Shell;. 六月 02, 2018 12:08:50 下午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["http-nio-80"] 六月 02, 2018 12:08:50 下午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector 信息: Using a shared selector for servlet write/read 六月 02, 2018 12:08:50 下午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["ajp-nio-8009"] 六月 02, 2018 12:08:50 下午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector 信息: Using a shared selector for servlet write/read 六月 02, 2018 12:08:50 下午 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 998 ms 六月 02, 2018 12:08:50 下午 org.apache.catalina.core.StandardService startInternal 信息: Starting service Catalina 六月 02, 2018 12:08:50 下午 org.apache.catalina.core.StandardEngine startInternal 信息: Starting Servlet Engine: Apache Tomcat/9.0.0.M17 六月 02, 2018 12:08:51 下午 org.apache.catalina.core.ContainerBase startInternal 严重: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to initialize component [[email protected]] 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:939) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) 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 initialize component [[email protected]] at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:441) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:139) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:173) at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:708) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4832) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4964) ... 7 more Caused by: java.lang.IllegalArgumentException: java.util.zip.ZipException: invalid LOC header (bad signature) at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.initInternal(AbstractSingleArchiveResourceSet.java:113) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136) ... 12 more Caused by: java.util.zip.ZipException: invalid LOC header (bad signature) at java.util.zip.ZipFile.read(Native Method) at java.util.zip.ZipFile.access$1400(ZipFile.java:60) at java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:717) at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:419) at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158) at sun.misc.IOUtils.readFully(IOUtils.java:65) at java.util.jar.JarFile.getBytes(JarFile.java:425) at java.util.jar.JarFile.getManifestFromReference(JarFile.java:193) at java.util.jar.JarFile.getManifest(JarFile.java:180) at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.initInternal(AbstractSingleArchiveResourceSet.java:111) ... 13 more 六月 02, 2018 12:08:51 下午 org.apache.catalina.core.ContainerBase startInternal 严重: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: A child container failed during start 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:939) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.startup.Catalina.start(Catalina.java:655) 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:498) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:355) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:495) Caused by: org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:948) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) 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) 六月 02, 2018 12:08:51 下午 org.apache.catalina.startup.Catalina start 严重: The required Server component failed to start so Tomcat is unable to start. org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:948) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.startup.Catalina.start(Catalina.java:655) 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:498) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:355) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:495) 六月 02, 2018 12:08:51 下午 org.apache.coyote.AbstractProtocol pause 信息: Pausing ProtocolHandler ["http-nio-80"] 六月 02, 2018 12:08:51 下午 org.apache.coyote.AbstractProtocol pause 信息: Pausing ProtocolHandler ["ajp-nio-8009"] 六月 02, 2018 12:08:51 下午 org.apache.catalina.core.StandardService stopInternal 信息: Stopping service Catalina 六月 02, 2018 12:08:51 下午 org.apache.coyote.AbstractProtocol destroy 信息: Destroying ProtocolHandler ["http-nio-80"] 六月 02, 2018 12:08:51 下午 org.apache.coyote.AbstractProtocol destroy 信息: Destroying ProtocolHandler ["ajp-nio-8009"]
Eclipse报错如下图
这个错误几乎是致命的,好多同事都遇到了,那么解决的办法什么什么呢?很多人都是把Tomcat Server删除了然后重新ADD解决的,但是我这里连续操作了这个步骤不起作用,也有人说是以为maven包冲突或者是maven依赖没有添加导致的,于是我的解决办法如下
1:因为怀疑是maven仓库的问题,于是我重新下载了maven并且配置了环境变量,配置了path变量
http://mirror.bit.edu.cn/apache/maven/maven-3/3.5.3/binaries/apache-maven-3.5.3-bin.zip
在命令行测试maven,保证maven环境没问题
2:给Eclipse重新配置maven环境
首先,新建一个D:\maven\repository文件夹作为本地仓库,默认在C盘我的用户下面,这里新建一个目录方便查找
其次修改D:\apache-maven-3.5.3-bin\conf 我们从官网下的maven解压目录配置目录中的settings.xml,如下图
然后进入Eclipse进行设置,如下图我们输入新的maven配置文件地址,系统会自动识别到我们新的本地仓库位置,点击apply,点击OK
上一步配置OK后,我们右键项目-Maven-Update Project ,Force Update 是强制更新
这个时候工具会根据pom.xml从公网仓库下载所需jar到本地仓库,下载完成如下图所示
到这里配置完成,我们把项目clean一下,然后把server删除重新根据Tomcat9创建一个server,右键运行发现错误不再发生了
原文地址:https://www.cnblogs.com/wxjnew/p/9125463.html