简体   繁体   中英

Exception in thread “main” java.util.zip.ZipException: error in opening zip file

I'm trying to create a web application in NetBeans 8.2, for this I try to use Apache Tomcat 8.0.27 which is integrated into this version. Previously I worked with Tomcat and Netbeans without any problem but in one occasion it failed.

I tried to modify environment variables in addition to reinstalling NetBeans with all its components but it did not work. I looked for information in other questions but I didn't find anything useful, possibly some file is corrupted but if it were the case, I would like to know how to solve it with a simple and understandable explanation, in some forums I read about how to find corrupted files and solve some things but they are not so clear to me.

Specs: - Windows - Netbeans 8.2 - Tomcat 8.0.27 - JDK & JDR 1.8.0.191

**Exception in thread "main" java.lang.InternalError:** java.util.zip.ZipException: error in opening zip file
    at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:1052)
    at sun.misc.URLClassPath.getResource(URLClassPath.java:249)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.util.ResourceBundle$RBClassLoader.loadClass(ResourceBundle.java:512)
    at java.util.ResourceBundle$Control.newBundle(ResourceBundle.java:2649)
    at java.util.ResourceBundle.loadBundle(ResourceBundle.java:1510)
    at java.util.ResourceBundle.findBundle(ResourceBundle.java:1474)
    at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1370)
    at java.util.ResourceBundle.getBundle(ResourceBundle.java:782)
    at sun.security.provider.AuthPolicyFile$1.run(AuthPolicyFile.java:74)
    at sun.security.provider.AuthPolicyFile$1.run(AuthPolicyFile.java:71)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.security.provider.AuthPolicyFile.<clinit>(AuthPolicyFile.java:71)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at javax.security.auth.Policy$2.run(Policy.java:236)
    at javax.security.auth.Policy$2.run(Policy.java:228)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Policy.getPolicyNoCheck(Policy.java:227)
    at javax.security.auth.Policy.getPolicy(Policy.java:197)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.catalina.core.JreMemoryLeakPreventionListener.lifecycleEvent(JreMemoryLeakPreventionListener.java:349)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:99)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:576)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:599)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:310)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:484)

**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: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 sun.misc.URLClassPath$JarLoader.getJarFile(URLClassPath.java:940)
    at sun.misc.URLClassPath$JarLoader.access$800(URLClassPath.java:801)
    at sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:886)
    at sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:879)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.misc.URLClassPath$JarLoader.ensureOpen(URLClassPath.java:878)
    at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:1050)
    ... 44 more

I would expect Tomcat to deploy without any problem but instead it is simply not deployed, sending the error every time.

Update: I installed the same NetBeans but in other computer AND it worked. I copyied the files of Tomcat and NetBeans but the error still (So, theres no a problem related to corrupted.jars i think). The project that im using to test it's a basic HTML page... A default Java web project.

This problem in most part of times is a Exception of corrupted jars. Are you trying to connect to any database? If yes, try to remove .jar file from lib folder on WebContent and copy the file from your computer directory to your folder on IDE and try again. If no, try to do this procedure to all of .jars that you're using on your project and replace them all again.

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