Published on Sep 8 2011 in Java

Possible cause and solution for java.util.zip.ZipException: invalid entry CRC

If your application is not being deployed and you are getting in application server logs:


SEVERE: Error in dependencyCheck
java.util.zip.ZipException: invalid entry CRC (expected 0x0 but got 0x6cdda3aa)
      at java.util.zip.ZipInputStream.read(ZipInputStream.java:171)
      at java.util.jar.JarInputStream.read(JarInputStream.java:177)
      at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
      at java.io.BufferedInputStream.read(BufferedInputStream.java:317)

it probably means that one of your JAR files is bad (JAR files are just ZIP files).

You can login via SSH then go to the directory containing the jars and run:

for a in `ls *.jar`; do unzip -qq -t $a &>/dev/null; if [ $? -ne 0 ]; then echo "$a"; fi; done

This will test the jars and print the ones with errors. You can also compare md5 checksums of jar or war files uploaded to the server with the ones deploying correctly on your local PC.