8 Replies Latest reply on Jan 16, 2009 6:09 AM by jaikiran pai

    Error loading sqljdbc.jar

    Carl Chaplin Newbie

      New at this and sorry if this has already been talked about but I couldn't find it previously.

      I'm trying to install our app. We copy the default directory to a new dir and rename it (to test1). I then add the sqljdbc.jar driver to the lib directory /dsk01/jboss-5.0.0.GA-jdk6/server/test1/lib/sqljdbc.jar. When trying to start JBoss i get the following error

      14:31:10,509 ERROR [AbstractKernelController] Error installing to ClassLoader: name=vfsfile:/dsk01/jboss-5.0.0.GA-jdk6/server/test1/conf/jboss-service.xml state=Describe mode=Manual requiredState=ClassLoader
      org.jboss.deployers.spi.DeploymentException: Error creating classloader for vfsfile:/dsk01/jboss-5.0.0.GA-jdk6/server/test1/conf/jboss-service.xml
      at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
      at org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext.createClassLoader(AbstractDeploymentContext.java:576)
      at org.jboss.deployers.structure.spi.helpers.AbstractDeploymentUnit.createClassLoader(AbstractDeploymentUnit.java:159)
      at org.jboss.deployers.spi.deployer.helpers.AbstractClassLoaderDeployer.deploy(AbstractClassLoaderDeployer.java:53)
      at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
      at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
      at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
      at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
      at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:545)
      at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:274)
      at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:205)
      at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:405)
      at org.jboss.Main.boot(Main.java:209)
      at org.jboss.Main$1.run(Main.java:547)
      at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.Error: Error visiting DelegatingHandler@22021341[path=sqljdbc.jar context=file:/dsk01/jboss-5.0.0.GA-jdk6/server/test1/lib/ real=file:/dsk01/jboss-5.0.0.GA-jdk6/server/test1/lib/sqljdbc.jar]
      at org.jboss.classloading.plugins.vfs.PackageVisitor.determineAllPackages(PackageVisitor.java:98)
      at org.jboss.deployers.vfs.plugins.classloader.VFSDeploymentClassLoaderPolicyModule.determineCapabilities(VFSDeploymentClassLoaderPolicyModule.java:108)
      at org.jboss.classloading.spi.dependency.Module.getCapabilities(Module.java:485)
      at org.jboss.classloading.spi.dependency.Module.determinePackageNames(Module.java:544)
      at org.jboss.classloading.spi.dependency.Module.getPackageNames(Module.java:529)
      at org.jboss.deployers.vfs.plugins.classloader.VFSDeploymentClassLoaderPolicyModule.determinePolicy(VFSDeploymentClassLoaderPolicyModule.java:129)
      at org.jboss.deployers.vfs.plugins.classloader.VFSDeploymentClassLoaderPolicyModule.determinePolicy(VFSDeploymentClassLoaderPolicyModule.java:48)
      at org.jboss.classloading.spi.dependency.policy.ClassLoaderPolicyModule.getPolicy(ClassLoaderPolicyModule.java:149)
      at org.jboss.deployers.vfs.plugins.classloader.VFSDeploymentClassLoaderPolicyModule.getPolicy(VFSDeploymentClassLoaderPolicyModule.java:122)
      at org.jboss.deployers.vfs.plugins.classloader.VFSDeploymentClassLoaderPolicyModule.getPolicy(VFSDeploymentClassLoaderPolicyModule.java:48)
      at org.jboss.classloading.spi.dependency.policy.ClassLoaderPolicyModule.registerClassLoaderPolicy(ClassLoaderPolicyModule.java:88)
      at org.jboss.deployers.plugins.classloading.AbstractLevelClassLoaderSystemDeployer.createClassLoader(AbstractLevelClassLoaderSystemDeployer.java:120)
      at org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext.createClassLoader(AbstractDeploymentContext.java:562)
      ... 21 more
      Caused by: java.lang.RuntimeException: Failed to read zip file: org.jboss.virtual.plugins.context.zip.ZipFileWrapper@ca9a2d - /dsk01/jboss-5.0.0.GA-jdk6/server/test1/tmp/vfs-nested.tmp/4c4d73ba_sqljdbc.jar
      at org.jboss.virtual.plugins.context.zip.ZipEntryContext.ensureEntries(ZipEntryContext.java:563)
      at org.jboss.virtual.plugins.context.zip.ZipEntryContext.checkIfModified(ZipEntryContext.java:693)
      at org.jboss.virtual.plugins.context.zip.ZipEntryContext.getChildren(ZipEntryContext.java:765)
      at org.jboss.virtual.plugins.context.zip.ZipEntryHandler.getChildren(ZipEntryHandler.java:149)
      at org.jboss.virtual.plugins.context.DelegatingHandler.getChildren(DelegatingHandler.java:120)
      at org.jboss.virtual.plugins.context.AbstractVFSContext.getChildren(AbstractVFSContext.java:171)
      at org.jboss.virtual.plugins.context.AbstractVFSContext.visit(AbstractVFSContext.java:288)
      at org.jboss.virtual.plugins.context.AbstractVFSContext.visit(AbstractVFSContext.java:258)
      at org.jboss.virtual.VFS.visit(VFS.java:404)
      at org.jboss.virtual.VirtualFile.visit(VirtualFile.java:407)
      at org.jboss.virtual.VirtualFile.getChildren(VirtualFile.java:356)
      at org.jboss.virtual.VirtualFile.getChildren(VirtualFile.java:337)
      at org.jboss.classloading.plugins.vfs.PackageVisitor.visit(PackageVisitor.java:200)
      at org.jboss.virtual.plugins.vfs.helpers.WrappingVirtualFileHandlerVisitor.visit(WrappingVirtualFileHandlerVisitor.java:62)
      at org.jboss.virtual.plugins.context.AbstractVFSContext.visit(AbstractVFSContext.java:313)
      at org.jboss.virtual.plugins.context.AbstractVFSContext.visit(AbstractVFSContext.java:258)
      at org.jboss.virtual.VFS.visit(VFS.java:404)
      at org.jboss.virtual.VirtualFile.visit(VirtualFile.java:407)
      at org.jboss.classloading.plugins.vfs.PackageVisitor.determineAllPackages(PackageVisitor.java:94)
      ... 33 more
      Caused by: java.util.zip.ZipException: error in opening zip file
      at java.util.zip.ZipFile.open(Native Method)
      at java.util.zip.ZipFile.(ZipFile.java:114)
      at java.util.zip.ZipFile.(ZipFile.java:131)
      at org.jboss.virtual.plugins.context.zip.ZipFileWrapper.ensureZipFile(ZipFileWrapper.java:175)
      at org.jboss.virtual.plugins.context.zip.ZipFileWrapper.acquire(ZipFileWrapper.java:245)
      at org.jboss.virtual.plugins.context.zip.ZipEntryContext.initEntries(ZipEntryContext.java:461)
      at org.jboss.virtual.plugins.context.zip.ZipEntryContext.ensureEntries(ZipEntryContext.java:554)
      ... 51 more
      14:31:10,510 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

      *** CONTEXTS IN ERROR: Name -> Error

      vfsfile:/dsk01/jboss-5.0.0.GA-jdk6/server/test1/conf/jboss-service.xml -> java.util.zip.ZipException: error in opening zip file

      If I remove the sqljdbc.jar file from the lib directory JBoss starts up fine ?

      Does anyone have any ideas on why this is happening.

      Thanks in advance -

      Chapc

      14:31:10,511 INFO [ServerImpl] JBoss (Microcontainer) [5.0.0.GA (build: SVNTag=JBoss_5_0_0_GA date=200812042120)] Started in 2s:980ms

        • 1. Re: Error loading sqljdbc.jar
          Peter Johnson Master

          Based on the root cause:

          Caused by: java.util.zip.ZipException: error in opening zip file

          I suspect that the sqljdbc.jar file is corrupt. Try opening it using:

          jar -ft sqljdbc.jar

          • 2. Re: Error loading sqljdbc.jar
            jaikiran pai Master

            I believe this was fixed as part of https://jira.jboss.org/jira/browse/JBAS-6061.

            Also see this http://www.jboss.com/index.html?module=bb&op=viewtopic&t=143892. Did you change any configuration files of JBoss while creating the new "test1" configuration?

            • 3. Re: Error loading sqljdbc.jar
              jaikiran pai Master

              Confirmed, the issue still exists (even on the "default" server configuration) for JBoss-5.0 GA. Placing the sqljdbc.jar file in common/lib or even in default/lib causes the server deployment to fail:

              14:21:42,964 ERROR [AbstractKernelController] Error installing to ClassLoader: name=vfsfile:/home/jpai/jboss-5.0.0.GA/server/default/conf/jboss-service.xml state=Describe mode=Manual requiredState=ClassLoader
              org.jboss.deployers.spi.DeploymentException: Error creating classloader for vfsfile:/home/jpai/jboss-5.0.0.GA/server/default/conf/jboss-service.xml
               at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
               at org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext.createClassLoader(AbstractDeploymentContext.java:576)
               at org.jboss.deployers.structure.spi.helpers.AbstractDeploymentUnit.createClassLoader(AbstractDeploymentUnit.java:159)
               at org.jboss.deployers.spi.deployer.helpers.AbstractClassLoaderDeployer.deploy(AbstractClassLoaderDeployer.java:53)
               at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
               at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
               at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
               at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
               at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
               at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
               at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
               at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
               at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
               at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
               at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
               at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
               at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:545)
               at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:274)
               at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:205)
               at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:405)
               at org.jboss.Main.boot(Main.java:209)
               at org.jboss.Main$1.run(Main.java:547)
               at java.lang.Thread.run(Thread.java:595)
              Caused by: java.lang.Error: Error visiting DelegatingHandler@12592762[path=sqljdbc.jar context=file:/home/jpai/jboss-5.0.0.GA/common/lib/ real=file:/home/jpai/jboss-5.0.0.GA/common/lib/sqljdbc.jar]
               at org.jboss.classloading.plugins.vfs.PackageVisitor.determineAllPackages(PackageVisitor.java:98)
               at org.jboss.deployers.vfs.plugins.classloader.VFSDeploymentClassLoaderPolicyModule.determineCapabilities(VFSDeploymentClassLoaderPolicyModule.java:108)
               at org.jboss.classloading.spi.dependency.Module.getCapabilities(Module.java:485)
               at org.jboss.classloading.spi.dependency.Module.determinePackageNames(Module.java:544)
               at org.jboss.classloading.spi.dependency.Module.getPackageNames(Module.java:529)
               at org.jboss.deployers.vfs.plugins.classloader.VFSDeploymentClassLoaderPolicyModule.determinePolicy(VFSDeploymentClassLoaderPolicyModule.java:129)
               at org.jboss.deployers.vfs.plugins.classloader.VFSDeploymentClassLoaderPolicyModule.determinePolicy(VFSDeploymentClassLoaderPolicyModule.java:48)
               at org.jboss.classloading.spi.dependency.policy.ClassLoaderPolicyModule.getPolicy(ClassLoaderPolicyModule.java:149)
               at org.jboss.deployers.vfs.plugins.classloader.VFSDeploymentClassLoaderPolicyModule.getPolicy(VFSDeploymentClassLoaderPolicyModule.java:122)
               at org.jboss.deployers.vfs.plugins.classloader.VFSDeploymentClassLoaderPolicyModule.getPolicy(VFSDeploymentClassLoaderPolicyModule.java:48)
               at org.jboss.classloading.spi.dependency.policy.ClassLoaderPolicyModule.registerClassLoaderPolicy(ClassLoaderPolicyModule.java:88)
               at org.jboss.deployers.plugins.classloading.AbstractLevelClassLoaderSystemDeployer.createClassLoader(AbstractLevelClassLoaderSystemDeployer.java:120)
               at org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext.createClassLoader(AbstractDeploymentContext.java:562)
               ... 21 more
              Caused by: java.lang.RuntimeException: Failed to read zip file: org.jboss.virtual.plugins.context.zip.ZipFileWrapper@1aff40f - /home/jpai/jboss-5.0.0.GA/server/default/tmp/vfs-nested.tmp/87845108_sqljdbc.jar
               at org.jboss.virtual.plugins.context.zip.ZipEntryContext.ensureEntries(ZipEntryContext.java:563)
               at org.jboss.virtual.plugins.context.zip.ZipEntryContext.checkIfModified(ZipEntryContext.java:693)
               at org.jboss.virtual.plugins.context.zip.ZipEntryContext.getChildren(ZipEntryContext.java:765)
               at org.jboss.virtual.plugins.context.zip.ZipEntryHandler.getChildren(ZipEntryHandler.java:149)
               at org.jboss.virtual.plugins.context.DelegatingHandler.getChildren(DelegatingHandler.java:120)
               at org.jboss.virtual.plugins.context.AbstractVFSContext.getChildren(AbstractVFSContext.java:171)
               at org.jboss.virtual.plugins.context.AbstractVFSContext.visit(AbstractVFSContext.java:288)
               at org.jboss.virtual.plugins.context.AbstractVFSContext.visit(AbstractVFSContext.java:258)
               at org.jboss.virtual.VFS.visit(VFS.java:404)
               at org.jboss.virtual.VirtualFile.visit(VirtualFile.java:407)
               at org.jboss.virtual.VirtualFile.getChildren(VirtualFile.java:356)
               at org.jboss.virtual.VirtualFile.getChildren(VirtualFile.java:337)
               at org.jboss.classloading.plugins.vfs.PackageVisitor.visit(PackageVisitor.java:200)
               at org.jboss.virtual.plugins.vfs.helpers.WrappingVirtualFileHandlerVisitor.visit(WrappingVirtualFileHandlerVisitor.java:62)
               at org.jboss.virtual.plugins.context.AbstractVFSContext.visit(AbstractVFSContext.java:313)
               at org.jboss.virtual.plugins.context.AbstractVFSContext.visit(AbstractVFSContext.java:258)
               at org.jboss.virtual.VFS.visit(VFS.java:404)
               at org.jboss.virtual.VirtualFile.visit(VirtualFile.java:407)
               at org.jboss.classloading.plugins.vfs.PackageVisitor.determineAllPackages(PackageVisitor.java:94)
               ... 33 more
              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:203)
               at java.util.zip.ZipFile.<init>(ZipFile.java:234)
               at org.jboss.virtual.plugins.context.zip.ZipFileWrapper.ensureZipFile(ZipFileWrapper.java:175)
               at org.jboss.virtual.plugins.context.zip.ZipFileWrapper.acquire(ZipFileWrapper.java:245)
               at org.jboss.virtual.plugins.context.zip.ZipEntryContext.initEntries(ZipEntryContext.java:461)
               at org.jboss.virtual.plugins.context.zip.ZipEntryContext.ensureEntries(ZipEntryContext.java:554)
               ... 51 more



              A bit of debugging shows that this piece of code in ZipEntryContext, gets a null exception handler:
              ExceptionHandler eh = getExceptionHandler();
               if (eh != null)
               eh.handleZipEntriesInitException(ex, getZipSource().getName());
               else
               throw new RuntimeException("Failed to read zip file: " + getZipSource(), ex);


              and hence the NamesExceptionHandler set in the vfs.xml doesn't come into play.


              • 4. Re: Error loading sqljdbc.jar
                jaikiran pai Master

                 

                "PeterJ" wrote:

                I suspect that the sqljdbc.jar file is corrupt.



                The jar file incorrectly includes a zero length nested jar as well as a old version of itself http://social.msdn.microsoft.com/forums/en-US/sqldataaccess/thread/a0a00f20-c235-47e6-bd53-dba281a83d57

                • 5. Re: Error loading sqljdbc.jar
                  jaikiran pai Master

                  The vfs.xml is unchanged and looks like:

                  <bean name="VfsNamesExceptionHandler" class="org.jboss.virtual.plugins.context.helpers.NamesExceptionHandler">
                   <constructor>
                   <parameter class="java.lang.String">sqljdbc.jar</parameter>
                   </constructor>
                   </bean>
                  
                   <bean name="JBossVFSInitializer" class="org.jboss.virtual.plugins.cache.PreInitializeVFSContexts">
                   <property name="initializedVFSContexts" class="java.util.Map">
                   <map keyClass="java.net.URL" valueClass="org.jboss.virtual.spi.ExceptionHandler">
                   <entry>
                   <key>${jboss.lib.url}</key>
                   <value><null/></value>
                   </entry>
                   <entry>
                   <key>${jboss.common.lib.url}</key>
                   <value><inject bean="VfsNamesExceptionHandler"/></value>
                   </entry>
                   <entry>
                   <key>${jboss.server.lib.url}</key>
                   <value><inject bean="VfsNamesExceptionHandler"/></value>
                   </entry>
                   </map>
                   </property>
                   <property name="holdReference">true</property>
                   </bean>


                  The debugger shows the exceptionhandler is being set for a FileSystemContext (for file:/blah/blah/jboss-5.0.0.GA/common/lib/) and which effectively means that the ZipEntryContext (for the sqljdbc.jar) doesn't have a exception handler.

                  • 6. Re: Error loading sqljdbc.jar
                    jaikiran pai Master

                    pegachapc,

                    A possible workaround for you is to :

                    1) Delete the nested sqljdbc.jar (of size 0) and the sqljdbc.jar.old from the sqljdbc.jar driver. As noted in the MSDN forum link that i posted earlier, the nested jars are redundant.

                    OR

                    2) See there's a newer version of the JDBC jar available which fixes the packaging issue.

                    • 7. Re: Error loading sqljdbc.jar
                      Ales Justin Master

                       

                      "jaikiran" wrote:
                      Confirmed, the issue still exists (even on the "default" server configuration) for JBoss-5.0 GA. Placing the sqljdbc.jar file in common/lib or even in default/lib causes the server deployment to fail:

                      Even if you 'cover' the root in vfs.xml with exception handler?

                      But I guess this is the line that covers jboss-5.0.0.GA-jdk6/server/test1/lib/:
                       <entry>
                       <key>${jboss.server.lib.url}</key>
                       <value><inject bean="VfsNamesExceptionHandler"/></value>
                       </entry>
                      


                      I'll check why the exception handler is not passes all the way to ZEH.

                      • 8. Re: Error loading sqljdbc.jar
                        jaikiran pai Master

                         

                        "alesj" wrote:

                        Even if you 'cover' the root in vfs.xml with exception handler?

                        Yes.

                        "alesj" wrote:

                        But I guess this is the line that covers jboss-5.0.0.GA-jdk6/server/test1/lib/:
                         <entry>
                         <key>${jboss.server.lib.url}</key>
                         <value><inject bean="VfsNamesExceptionHandler"/></value>
                         </entry>
                        




                        That's correct. That's the entry which covers the root under which the jar file is present. For some reason, this configuration is not getting propagated to the ZipEntryContext.