can't deploying War file : error in opening zi

2020-04-21 00:25发布

I'm working on a web application based in java which is correctly running in local with Jetty but I can't deploy a War version on a linux server with Tomcat. I get in the Catalina.out file : error in opening zip file.

I read a lot of topics about this error (permissions, corrupted jar files...) but none helps me. How to find more explanations or details about this error ?

Here is the stack trace :

18-Jan-2016 10:39:01.036 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1663 ms
18-Jan-2016 10:39:01.109 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
18-Jan-2016 10:39:01.109 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.30
18-Jan-2016 10:39:01.168 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /opt/tomcat/webapps/UserInterface-1.0-SNAPSHOT.war
18-Jan-2016 10:39:02.235 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start: 
 org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/UserInterface-1.0-SNAPSHOT]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    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.deployWAR(HostConfig.java:945)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1795)
    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: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 [org.apache.catalina.webresources.StandardRoot@6da9455d]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4928)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5058)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 10 more
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.JarResourceSet@6e366f32]
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
    at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:699)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 13 more
Caused by: java.lang.IllegalArgumentException: java.util.zip.ZipException: error in opening zip file
    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: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java:219)
    at java.util.zip.ZipFile.<init>(ZipFile.java:149)
    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

Thanks,

4条回答
等我变得足够好
2楼-- · 2020-04-21 00:43

This issue is mainly because of the corrupted JARS in your deployment war file.

unzip <artifact-name>.war 
find <artifact-folder>  -name "*jar" | xargs -L 1 zip -T | grep error | grep invalid

This lists the corrupted JARS in the console.

Once you find the corrupted JARS, either manually replaces the JARS in the lib folder or Create a new build and deploy it.

查看更多
何必那么认真
3楼-- · 2020-04-21 00:45

possible reasons for this issue are:
1. your application/WEB-INF/lib may contain duplicate jar
2. improper permission to application or application/WEB-INF/lib

查看更多
该账号已被封号
4楼-- · 2020-04-21 01:06

I meet the similar issue. "Caused by: java.util.zip.ZipException: error in opening zip file", I deleted .m2/repository folder, regenerator the war, and then fixed.

查看更多
▲ chillily
5楼-- · 2020-04-21 01:07

I also got the same issue .it happens because corrupted jars.

solution: remove the corrupted jar and replace it again from the correct jar.create the new WAR File

查看更多
登录 后发表回答