Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6457007

Bundled Xerces XML parser locks jar(s) in classpath on Windows (open streams)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 6
    • xml

      FULL PRODUCT VERSION :
      java version "1.6.0-rc"
      Java(TM) SE Runtime Environment (build 1.6.0-rc-b93)
      Java HotSpot(TM) Client VM (build 1.6.0-rc-b93, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      The release of Xerces that is bundled with Java SE has a known problem opening a stream but not closing it. In GlassFish in particular this locks jar file(s) in a deployed application which then prevents the undeployment or redeployment of the app on Windows.

      The output from

      javap -c -classpath "%java_home%/jre/lib/rt.jar" com.sun.org.apache.xerces.internal.impl.Version

      suggests that Xerces-J 2.6.2 is the bundled Xerces version in Mustang b93, as it is in 1.5.0_06.

      Can this problem be fixed in the bundled Xerces code, either by incorporating Xerces 2.8 (which contains the fix)? (I expect that answer to that is "no" due to the relatively late date at this point.) What about by surgically repairing this error? The attached stack trace shows the active call frames at the time the locked JAR was opened.

      I have looked but have not found a Xerces issue that identifies this particular problem and pinpoints the solution. The discussion in this GlassFish issue (https://glassfish.dev.java.net/issues/show_bug.cgi?id=354 - see the entry for Additional comments from bjb Fri Jul 7 16:53:43 +0000 2006) does indicate that Xerces 2.8 contains a solution. The notes on the Apache site describing the various Xerces releases do not give detailed info about each bug fixed.





      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      An attachment to the GlassFish issue is an EAR file, an enterprise application. See the first set of notes on that issue for instructions to reproduce this behavior.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Xerces parser would close streams when it finishes with them.
      ACTUAL -
      Xerces keeps at least one stream open after it is finished. On Windows, this prevents the JAR file to which the stream was opened from being removed or overwritten, thus causing undeployment and/or redeployment of the app using GlassFish to fail.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.util.zip.ZipFile.<init>(ZipFile.java:242)
      java.util.jar.JarFile.<init>(JarFile.java:132)
      java.util.jar.JarFile.<init>(JarFile.java:70)
      sun.net.www.protocol.jar.URLJarFile.&lt;init&gt;(URLJarFile.java:56)
      sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:41)
      sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:63)
      sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:102)
      sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:124)
      com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:973)
      com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:905)
      com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:872)
      com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:282)
      com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(XMLDocumentScannerImpl.java:1021)
      com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
      com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
      com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
      com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)^Mcom.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
      javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
      javax.xml.parsers.SAXParser.parse(SAXParser.java:176)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      As reported in the GlassFish issue, bundling Xerces 2.8 with the application works around this issue, but this is cumbersome for the developer, inflates the size of the user's application, and slows down deployment of the app.

            spericas Santiago Pericasgeertsen
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: