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

后端 未结 15 2554
眼角桃花
眼角桃花 2020-12-14 03:19


I got this error in Catalina.2011-03-30.log when my display.war file executed on Tomcat. The error is shown below:

Mar 30, 2011 8:01:31 PM org.apac         


        
相关标签:
15条回答
  • 2020-12-14 03:57

    Aby's specific problem seems to be resolved, but in case someone else stumbles onto this page with the same problem I had...

    Make sure that your /opt/solr directory has the correct permissions set. I was following the SolrJetty tutorial before later moving to the Tomcat install. Because my solr user was created with this command:

    useradd -d /opt/solr -s /sbin/false solr
    

    the /opt/solr directory was created with permissions 700, so tomcat could not get to the WAR file. Change to 755 and it worked perfectly.

    0 讨论(0)
  • 2020-12-14 04:01

    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.

    0 讨论(0)
  • 2020-12-14 04:04

    BalusC is right. I encountered this error when I ran my webapp on a Linux box that had the openjdk version of Java installed instead of a regular JDK. After installing a normal JDK and pointing tomcat's JRE_HOME variable to the normal JDK the problem disappeared.

    0 讨论(0)
  • 2020-12-14 04:06

    Make sure your path to the WAR file is correct. I had a typo and this got that same error.

    0 讨论(0)
  • 2020-12-14 04:07

    Unfortunately, the cause and the solution is not that obvious as Buhake Sindi 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 500 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.
    0 讨论(0)
  • 2020-12-14 04:10

    In my case war file not downloaded properly from the repository as size is in few KB. After corrected my download syntax started properly

    0 讨论(0)
提交回复
热议问题