java.util.zip.ZipException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Another problem executing JAR files
    via by 843802,
  • I found from the JIRA database that EJB-178 and EJB-181 were written regarding the issue of the Entity Manager not handling paths with spaces in them correctly, and they both are in the 'resolved' state. However, in 3.2.0.cr2 of the EntityManager, I still get this error when running the PackagedEntityManagerTest testExplodedPar JUnit test from a root directory that contains spaces: 12:20:34,331 DEBUG JarVisitor:192 - Searching mapped entities in jar/par: file:/D:/User%20Data/Eclipse_Workspaces/Test/HibernateEntityManagerTest/build/testresources/explodedpar.par 12:20:34,346 WARN FileZippedJarVisitor:37 - Unable to find file (ignored): file:/D:/User%20Data/Eclipse_Workspaces/Test/HibernateEntityManagerTest/build/testresources/explodedpar.par java.util.zip.ZipException: Access is denied at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(ZipFile.java:203) at java.util.jar.JarFile.<init>(JarFile.java:132) at java.util.jar.JarFile.<init>(JarFile.java:70) at org.hibernate.ejb.packaging.FileZippedJarVisitor.doProcessElements(FileZippedJarVisitor.java:34) at org.hibernate.ejb.packaging.JarVisitor.getMatchingEntries(JarVisitor.java:215) at org.hibernate.ejb.Ejb3Configuration.addMetadataFromVisitor(Ejb3Configuration.java:251) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:227) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37) at org.hibernate.ejb.test.PackagedEntityManagerTest.testExplodedPar(PackagedEntityManagerTest.java:110) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) After looking at the EJB-178 and EJB-181 errors and the code, it appears that what happened was that EJB-178 was closed as a duplicate of EJB-181, but they are not the same error. It is the same jarUrl.getFile() call that causes the problem, but it is in different code: EJB-178 covers the org.hibernate.ejb.packaging.JarVisitor.getVisitor() method, whereas EJB-181 covers the org.hibernate.ejb.packaging.ExplodedJarVisitor.doProcessElements() . The source code shows that EJB-181 was fixed but EJB-178 was not. I put the fix in to the JarVisitor.getVisitor() method (changed jar Url.getFile() to jarUrl.toURI().getSchemeSpecificPart() and added exception handling) and rebuilt the Entity Manager jar. I then reran the PackagedEntityManagerTest testExplodedPar JUnit test using the new jar, and the JUnit passed.
    via by Michael Falco,
  • I'm using Hibernate Entity Manager with a WAR deployed on Tomcat 5.5.17, and I'm getting the following error: 11/05/2006 16:12:43 org.hibernate.ejb.packaging.FileZippedJarVisitor doProcessElements WARNING: Unable to find file (ignored): file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%205.5/webapps/[REST OMITTED] java.util.zip.ZipException: Access is denied at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(Unknown Source) at java.util.jar.JarFile.<init>(Unknown Source) at java.util.jar.JarFile.<init>(Unknown Source) at org.hibernate.ejb.packaging.FileZippedJarVisitor.doProcessElements(FileZippedJarVisitor.java:34) at org.hibernate.ejb.packaging.JarVisitor.getMatchingEntries(JarVisitor.java:208) at org.hibernate.ejb.Ejb3Configuration.addMetadataFromVisitor(Ejb3Configuration.java:201) at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:183) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:114) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37) [MORE...] Two strange things: 1) the directory exists; 2) Hibernate is treating the path as being part of a JAR file. I found the cause of the problem when analysing org.hibernate.ejb.packaging.JarVisitor.getVisitor(URL, Filter[]): File file = new File( jarUrl.getFile() ); if ( file.isDirectory() ) { return new ExplodedJarVisitor( jarUrl, filters ); } else { return new FileZippedJarVisitor( jarUrl, filters ); } As my path has some spaces, jarUrl.getFile() returns "/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%205.5/webapps/[REST OMITTED]", which is not a directory, because of the "%20"'s. The specification of the java.net.URL class says: "The URL class does not itself encode or decode any URL components according to the escaping mechanism defined in RFC2396. It is the responsibility of the caller to encode any fields, which need to be escaped prior to calling URL, and also to decode any escaped fields, that are returned from URL." Although I did not have the time to build the project with it, I think that jarUrl.toURI().getPath() would solve the problem. Here is a snippet to prove it: import java.io.File; import java.net.URL; public class Main { public static void main( String[] args ) throws Exception { URL url = new URL( "file:///C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%205.5/webapps" ); System.out.println( "url.getFile()" ); System.out.println( url.getFile() ); System.out.println( new File( url.getFile() ).isDirectory() ); System.out.println(); System.out.println(); System.out.println(); System.out.println( "url.toURI().getPath()" ); System.out.println( url.toURI().getPath() ); System.out.println( new File( url.toURI().getPath() ).isDirectory() ); } }
    via by Alexandrino Lucas,
  • I found from the JIRA database that EJB-178 and EJB-181 were written regarding the issue of the Entity Manager not handling paths with spaces in them correctly, and they both are in the 'resolved' state. However, in 3.2.0.cr2 of the EntityManager, I still get this error when running the PackagedEntityManagerTest testExplodedPar JUnit test from a root directory that contains spaces: 12:20:34,331 DEBUG JarVisitor:192 - Searching mapped entities in jar/par: file:/D:/User%20Data/Eclipse_Workspaces/Test/HibernateEntityManagerTest/build/testresources/explodedpar.par 12:20:34,346 WARN FileZippedJarVisitor:37 - Unable to find file (ignored): file:/D:/User%20Data/Eclipse_Workspaces/Test/HibernateEntityManagerTest/build/testresources/explodedpar.par java.util.zip.ZipException: Access is denied at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(ZipFile.java:203) at java.util.jar.JarFile.<init>(JarFile.java:132) at java.util.jar.JarFile.<init>(JarFile.java:70) at org.hibernate.ejb.packaging.FileZippedJarVisitor.doProcessElements(FileZippedJarVisitor.java:34) at org.hibernate.ejb.packaging.JarVisitor.getMatchingEntries(JarVisitor.java:215) at org.hibernate.ejb.Ejb3Configuration.addMetadataFromVisitor(Ejb3Configuration.java:251) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:227) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37) at org.hibernate.ejb.test.PackagedEntityManagerTest.testExplodedPar(PackagedEntityManagerTest.java:110) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) After looking at the EJB-178 and EJB-181 errors and the code, it appears that what happened was that EJB-178 was closed as a duplicate of EJB-181, but they are not the same error. It is the same jarUrl.getFile() call that causes the problem, but it is in different code: EJB-178 covers the org.hibernate.ejb.packaging.JarVisitor.getVisitor() method, whereas EJB-181 covers the org.hibernate.ejb.packaging.ExplodedJarVisitor.doProcessElements() . The source code shows that EJB-181 was fixed but EJB-178 was not. I put the fix in to the JarVisitor.getVisitor() method (changed jar Url.getFile() to jarUrl.toURI().getSchemeSpecificPart() and added exception handling) and rebuilt the Entity Manager jar. I then reran the PackagedEntityManagerTest testExplodedPar JUnit test using the new jar, and the JUnit passed.
    via by Michael Falco,
  • I'm using Hibernate Entity Manager with a WAR deployed on Tomcat 5.5.17, and I'm getting the following error: 11/05/2006 16:12:43 org.hibernate.ejb.packaging.FileZippedJarVisitor doProcessElements WARNING: Unable to find file (ignored): file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%205.5/webapps/[REST OMITTED] java.util.zip.ZipException: Access is denied at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(Unknown Source) at java.util.jar.JarFile.<init>(Unknown Source) at java.util.jar.JarFile.<init>(Unknown Source) at org.hibernate.ejb.packaging.FileZippedJarVisitor.doProcessElements(FileZippedJarVisitor.java:34) at org.hibernate.ejb.packaging.JarVisitor.getMatchingEntries(JarVisitor.java:208) at org.hibernate.ejb.Ejb3Configuration.addMetadataFromVisitor(Ejb3Configuration.java:201) at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:183) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:114) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37) [MORE...] Two strange things: 1) the directory exists; 2) Hibernate is treating the path as being part of a JAR file. I found the cause of the problem when analysing org.hibernate.ejb.packaging.JarVisitor.getVisitor(URL, Filter[]): File file = new File( jarUrl.getFile() ); if ( file.isDirectory() ) { return new ExplodedJarVisitor( jarUrl, filters ); } else { return new FileZippedJarVisitor( jarUrl, filters ); } As my path has some spaces, jarUrl.getFile() returns "/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%205.5/webapps/[REST OMITTED]", which is not a directory, because of the "%20"'s. The specification of the java.net.URL class says: "The URL class does not itself encode or decode any URL components according to the escaping mechanism defined in RFC2396. It is the responsibility of the caller to encode any fields, which need to be escaped prior to calling URL, and also to decode any escaped fields, that are returned from URL." Although I did not have the time to build the project with it, I think that jarUrl.toURI().getPath() would solve the problem. Here is a snippet to prove it: import java.io.File; import java.net.URL; public class Main { public static void main( String[] args ) throws Exception { URL url = new URL( "file:///C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%205.5/webapps" ); System.out.println( "url.getFile()" ); System.out.println( url.getFile() ); System.out.println( new File( url.getFile() ).isDirectory() ); System.out.println(); System.out.println(); System.out.println(); System.out.println( "url.toURI().getPath()" ); System.out.println( url.toURI().getPath() ); System.out.println( new File( url.toURI().getPath() ).isDirectory() ); } }
    via by Alexandrino Lucas,
    • java.util.zip.ZipException: Access is denied at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(ZipFile.java:112) at java.util.jar.JarFile.<init>(JarFile.java:127) at java.util.jar.JarFile.<init>(JarFile.java:65)

    Users with the same issue

    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    marcbouvierdav
    2 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    52 more bugmates