简体   繁体   中英

Tomcat 8 component start failed due java.util.zip.ZipException

I'm tasked on getting old java code to run on newer environment, and I have problem with getting Tomcat (8.0.32) to start component. In catalina.out logfile I get the following:

INFO: Using a shared selector for servlet write/read
Jul 04, 2019 3:27:30 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1232 ms
Jul 04, 2019 3:27:31 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jul 04, 2019 3:27:31 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.32 (Ubuntu)
Jul 04, 2019 3:27:31 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor /etc/tomcat8/Catalina/localhost/reportServer.xml
Jul 04, 2019 3:27:31 PM org.apache.catalina.core.ContainerBase addChildInternal
SEVERE: ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/reportServer]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:585)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1794)
    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@79e9c8c8]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
    at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4937)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5067)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
    ... 10 more
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.JarResourceSet@3d9ef955]
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:136)
    at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:699)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
    ... 13 more
Caused by: java.lang.IllegalArgumentException: java.util.zip.ZipException: invalid END header (bad central directory offset)
    at org.apache.catalina.webresources.JarResourceSet.initInternal(JarResourceSet.java:96)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    ... 16 more
Caused by: java.util.zip.ZipException: invalid END header (bad central directory offset)
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java:225)
    at java.util.zip.ZipFile.<init>(ZipFile.java:155)
    at java.util.jar.JarFile.<init>(JarFile.java:166)
    at java.util.jar.JarFile.<init>(JarFile.java:103)
    at org.apache.catalina.webresources.JarResourceSet.initInternal(JarResourceSet.java:88)
    ... 17 more

Jul 04, 2019 3:27:31 PM org.apache.catalina.startup.HostConfig deployDescriptor
SEVERE: Error deploying configuration descriptor /etc/tomcat8/Catalina/localhost/reportServer.xml
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/reportServer]]
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:729)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:585)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1794)
    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)

It appears that Tomcat is trying to unzip something, but failing at it.

I'm not too familiar with either java or Tomcat, and so I'm unable to figure out what causes this failure to happen. Is there a common way to figure out what causes this problem? Normally I would try to run the code in question and try to debug that, but it appears that Tomcat environment is needed for running this code, and I cant find the source of the problem.

I also know that this code is successfully running in another virtual (production) server, where some components are older.

It's not able to extract a jar of the war. If you want to check this try to unzip all the libs of the war using a program or code which tomcat uses to unzip the jar. Or enable full stacktrace for tomcat to view full log and identify the corrupted jar. You can also try to rebuild the wars.

Problem solved, thank you for contributions. What was needed to make the problem disappear:

The problem was in ./WEB-INF/lib/xerces.jar, it was corrupt. I foud it with Luis Muñoz comment linking here . By replacing it with a non corrupt version, I was able to resolve the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM