1 2 Previous Next 15 Replies Latest reply on Aug 3, 2005 11:35 PM by 843802

    Another problem executing JAR files

    843802
      I generated a jar file from JBuilder9 and when I attempt to execute using

      javaw -jar jarfile

      I get a JVM Launcher popup with:
      Fatal exception occurred. Program will exit.

      When I use the command:

      java -jar jarfile

      I get:
      Exception in thread "main" 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)

      I even attempted to rebuild the jar file and specifically include java.util.zip.* and java.util.jar.*

      Anyone know what the problem is and how to resolve it?

      Thanks, Dave J.
        • 1. Re: Another problem executing JAR files
          843802
          You effectively don't need to include the util.zip and util.jar.

          They need to be extracted themselves, so if this would be neccessary, it would not be solvable. (chicken-egg -problem).
          You have an 'Access denied' - problem.

          So I guess the zip archive is somewhat protected and encrypted.
          Or didn't you mention, that 'main' is 'public'?


          • 2. Re: Another problem executing JAR files
            843802
            I am facing the same problem, but when I use the command prompt I get a nullpointerexception..
            Did you get the answer to the problem yet?
            I would be glad if you can help me.

            Thanks.
            • 3. Re: Another problem executing JAR files
              843802
              java.util.zip.ZipException: Access is denied

              Did you resolve this error? I am facing a same error on Tomcat on Win XP SP2 --Thanks                                                                                                                                                                                                                                                                       
              • 4. Re: Another problem executing JAR files
                843802
                java.util.zip.ZipException: Access is denied

                Did you resolve this error? I am facing a same error on Tomcat on Win XP SP2 --Thanks                                                                                                                                                                                                                                                                       
                • 5. Re: Another problem executing JAR files
                  843802
                  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 sun.net.www.protocol.jar.URLJarFile.<init>(Unknown Source)
                       at sun.net.www.protocol.jar.URLJarFile$1.run(Unknown Source)
                       at java.security.AccessController.doPrivileged(Native Method)
                       at sun.net.www.protocol.jar.URLJarFile.retrieve(Unknown Source)
                       at sun.net.www.protocol.jar.URLJarFile.getJarFile(Unknown Source)
                       at sun.net.www.protocol.jar.JarFileFactory.get(Unknown Source)
                       at sun.net.www.protocol.jar.JarURLConnection.connect(Unknown Source)
                       at sun.net.www.protocol.jar.JarURLConnection.getJarFile(Unknown Source)
                       at org.apache.catalina.startup.ContextConfig.tldScanJar(ContextConfig.java:906)
                       at org.apache.catalina.startup.ContextConfig.tldScan(ContextConfig.java:868)
                       at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:647)
                       at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:243)
                       at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
                       at org.apache.catalina.core.StandardContext.start(StandardContext.java:3567)
                       at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
                       at org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
                       at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
                       at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
                       at org.apache.catalina.core.StandardService.start(StandardService.java:497)
                       at org.apache.catalina.core.StandardServer.start(StandardServer.java:2189)
                       at org.apache.catalina.startup.Catalina.start(Catalina.java:514)
                       at org.apache.catalina.startup.Catalina.execute(Catalina.java:402)
                       at org.apache.catalina.startup.Catalina.process(Catalina.java:182)
                       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                       at java.lang.reflect.Method.invoke(Unknown Source)
                       at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)

                  The full error is attached
                  • 6. Re: Another problem executing JAR files
                    843802
                    I am getting the exact same error message on Tomcat 4 start up. I have gone as far as uninstalling Tomcat, deleting the entire Tomcat directory, redownloading the Tomcat set executable, and doing a whole new install. I STILL get this error, which says its occuring while trying to process struts.jar, which is part of the /admin module. Right now Timcat can't do anything because the admin module doesn't load up!

                    I've also tried adding a few other WAR files to the server. They install correctly using the manager web module, but I am then getting the ZipException: Access is denied" error on one jar file in eachh addition module I attempt to load! It seems to happen to the same jar files, but a fair amount of jar files are processed prior to the error, so it doesn't happen to all jar files.

                    I am completely lost and frustrated at this point. I can't think of anything I had done to my PC or the server to cause this to happen, and like I said a re-install doesn't help at all. I can't even get a clean copy of the server to fully load.

                    Hope someone can help.

                    P.S. Tomcat was running great up until last week...
                    • 7. Re: Another problem executing JAR files
                      843802
                      I had this same problem for a couple of weeks and it drove me nuts. Strange thing was that it used to work fine then one day Tomcat 4 would no longer start. We got the access denied error you describe.

                      We worked it out eventually but the cause turned out to be very strange indeed.

                      The machine was running Virus checking software, an Enterprise solution from Network Associates. This has all sorts of clever stuff in it including "on access" scanning. This got switched OFF one day to test whether it was affected IO performance. In this mode you get the "access denied" error. Turn it back ON and the problem goes away. Strange but true.

                      I can only figure that with the scanner off something else in the virus suite kicks in and stops any attempt to open up a zip file.

                      Could this be it for you too?
                      • 8. Re: Another problem executing JAR files
                        843802
                        Thanks for the workaround robwilliams2002 !

                        I have the exact same problem, in the same environment : win XP, McAffe 8 and Tomcat 4.1.30. So I tried to switching trick and it worked ...

                        Finally what I noticed is that any archive that was packaged with the "on-access scan" turned off will be locked when you try to deploy it on Tomcat ...

                        Rather weird, I followed that to my IT service ! I had feedback from them and it seems they are facing lots of issues with this release of the antivirus.

                        Too bad you have too choose between lame performance assorted with strange behaviors and a nasty virus alert ...
                        • 9. Re: Another problem executing JAR files
                          843802
                          Even I had same problem and it works juz fine with the solution suggested by robwilliams2002. Thanks a lot.
                          • 10. Re: Another problem executing JAR files
                            843802
                            Yes, I will have the same trouble with VirusScan Entreprise de McAfee 8.0. Strangely, i have two tomcat 4.1.30, one work and the other can not open the jar file. I have turned off the VirusScan services. The bad tomcat does not work. Then I reboot the PC. And after the bad tomcat works perfectly.
                            I have also VirusScan Entreprise de McAfee 7.0 on a other machine and Tomcat works perfectly. May be some wrong thing in the 8.0 ?
                            • 11. Re: Another problem executing JAR files
                              843802
                              i am using tomcat 5.0.16 with XP sp2, Symantec Norton Antivirus 9, having the same problem. How to solve it? I dont know what to disable..

                              thanks for helping..
                              • 12. Re: Another problem executing JAR files
                                843802
                                problem solved! :D
                                found a folder named mysql.jar in common\lib, deleted and solved!
                                • 13. Re: Another problem executing JAR files
                                  843802
                                  I also have McAfee v8.0i Enterprise but it was running when this same kind of exception occured. The problem was that the OnAccess scanner had java.exe setup as a Low Risk process in its process exclusion list. Once this process was removed from the exclusion list then everything started to work automagically again.

                                  Cheers, Sven.
                                  sresch@cadence.com
                                  • 14. Re: Another problem executing JAR files
                                    843802
                                    I was able to narrow this down to the setting for java.io.tmpdir. The problem occurs when tomcat is scanning jar files in WEBINF/lib for deployed webapps. It reads these through a jndi url (since they may be in an archive). In order to do this, java writes a temporary copy to java.io.tmpdir and opens that file. If McAfee is not scanning this directory, java will fail when it tries to read the file. (Even though file.canRead() is true at that point.)

                                    Long story short: Set java.io.tmpdir to a directory that is being scanned. Turn off scanning for any other temporary directories that tomcat may be using.
                                    1 2 Previous Next