Best unofficial Apache Server developers community
Username
Forgot password?
Sign in with Twitter account
Sign in with Facebook account

Error in Catalina.out: java.util.zip.ZipException: error in opening zip file and java.lang.IllegalArgumentException

0

74 views

Hello everyone,
I got this error in catalina.out when my display.war file executed on Tomcat. The error is shown below:

Mar 30, 2011 8:01:31 PM org.apache.catalina.startup.ContextConfig init  
SEVERE: Exception fixing docBase for context [/Display]   
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:114)
    at java.util.jar.JarFile.<init>(JarFile.java:135)
    at java.util.jar.JarFile.<init>(JarFile.java:72)
    at sun.net.www.protocol.jar.URLJarFile.<init>(URLJarFile.java:72)
    at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:48)
    at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:70)
    at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:104)
    at sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:71)
    at org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:148)
    at org.apache.catalina.startup.ContextConfig.fixDocBase(ContextConfig.java:886)
    at org.apache.catalina.startup.ContextConfig.init(ContextConfig.java:1021)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:279)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.StandardContext.init(StandardContext.java:5602)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4378)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
    at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
    at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1345)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:303)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
    at java.lang.Thread.run(Thread.java:662)  

Mar 30, 2011 8:01:31 PM org.apache.catalina.core.StandardContext resourcesStart
SEVERE: Error starting static Resources  

java.lang.IllegalArgumentException: Invalid or unreadable WAR file : error in opening zip file  
    at org.apache.naming.resources.WARDirContext.setDocBase(WARDirContext.java:135)  
    at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4249)  
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4418)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
    at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
    at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1345)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:303)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
    at java.lang.Thread.run(Thread.java:662)  

Thanks in advance.

asked March 30, 2011 7:10 pm CDT
Aby
posted via StackOverflow

2 Answers

1
 

The Cause is clearly shown:

java.lang.IllegalArgumentException: Invalid or unreadable WAR file : error in opening zip file  

A WAR (Web ARchive) file is a zip file containing your classes, libraries and resources for your web application.

Rename your WAR file from a.war to a.zip. If you can't open the zip file using Winzip/7-Zip/WinRar, rebuild your WAR file again.

Hope this helps.

answered March 30, 2011 7:23 pm CDT
0
 

Unfortunately, the cause and the solution is not that obvious as The Elite Gentlemen suggests. I've seen this problem several times before in several forums. I've even experienced it myself at least once. Google gives currently over 1000 hits on the exact exception message. All remains unanswered. There are however hints that it works in IDE X, but not on IDE Y and that it works on Server X, but not on Server Y. Or that removing or adding something from/to the WAR works (a typical example can be found here). Nobody has however explained the real root cause in depth.

I think that it has something to do with a combination of the JDK/JRE version used and the file size of the WAR. Here are some things you can try:

  • Try to update/align the JDK/JRE version in your IDE and/or appserver environment.
  • Try to add something to the WAR, some random JAR or JSP file or whatever and then rebuild.
answered March 31, 2011 6:25 pm CDT

Your answer

Join with account you already have


Sign in with Twitter account
Sign in with Facebook account
Sign in with Google Friend Connect

Preview
Similar questions
Java.util.regex
January 18, 2011