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

incorrect context classloader

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • 7u40
    • 7u25
    • deploy

      FULL PRODUCT VERSION :
      java version " 1.7.0_25 "
      Java(TM) SE Runtime Environment (build 1.7.0_25-b16)
      Java HotSpot(TM) Client VM (build 23.25-b01, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Windows 7 Ultimate 32 bit

      A DESCRIPTION OF THE PROBLEM :
      A lot of our customers started experiencing issue similar to http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4665132 after they updated to java 1.7.0_25.

      Our application fails to load xml parser, which is included in one of application jar files. Problem is caused by incorrect context class loader in Event Dispatch Thread. (incorrect one is instance of sun.misc.Launcher$AppClassLoader instead of correct one com.sun.jnlp.JNLPClassLoader)




      REGRESSION. Last worked in version 6u45


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Chyba p?i parsov?n? XML (Could not load org.apache.xerces.parsers.SAXParser: SAX2 driver class org.apache.xerces.parsers.SAXParser not found: org.apache.xerces.parsers.SAXParser)
      <br>file cz/elanor/eman/sgui/forms/opv01/Opv01Comps
      cz.elanor.eman.EmanException: Chyba p?i parsov?n? XML (Could not load org.apache.xerces.parsers.SAXParser: SAX2 driver class org.apache.xerces.parsers.SAXParser not found: org.apache.xerces.parsers.SAXParser)
      file cz/elanor/eman/sgui/forms/opv01/Opv01Comps
                      at cz.elanor.eman.Util.parseXML(SourceFile:390)
                      at cz.elanor.eman.Util.parseXML(SourceFile:368)
                      at cz.elanor.eman.EmanElement.getXMLRoot(SourceFile:739)
                      at cz.elanor.eman.EmanElement.getXMLbyXPath(SourceFile:797)
                      at cz.elanor.eman.EmanElement.getXMLofComp(SourceFile:896)
                      at cz.elanor.eman.sgui.navig.LeftPanel.createGraphForm(SourceFile:1017)
                      at cz.elanor.eman.sgui.navig.LeftPanel.createGraphForm(SourceFile:1027)
                      at cz.elanor.eman.sgui.navig.LeftPanel.setForm(SourceFile:759)
                      at cz.elanor.eman.sgui.navig.LeftPanel.getForm(SourceFile:655)
                      at cz.elanor.eman.sgui.navig.fj.a(SourceFile:448)
                      at cz.elanor.eman.sgui.navig.LeftPanel.executeNode(SourceFile:375)
                      at cz.elanor.eman.sgui.navig.de.mouseClicked(SourceFile:1107)
                      at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source)
                      at java.awt.Component.processMouseEvent(Unknown Source)
                      at javax.swing.JComponent.processMouseEvent(Unknown Source)
                      at java.awt.Component.processEvent(Unknown Source)
                      at java.awt.Container.processEvent(Unknown Source)
                      at java.awt.Component.dispatchEventImpl(Unknown Source)
                      at java.awt.Container.dispatchEventImpl(Unknown Source)
                      at java.awt.Component.dispatchEvent(Unknown Source)
                      at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
                      at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
                      at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
                      at java.awt.Container.dispatchEventImpl(Unknown Source)
                      at java.awt.Window.dispatchEventImpl(Unknown Source)
                      at java.awt.Component.dispatchEvent(Unknown Source)
                      at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
                      at java.awt.EventQueue.access$200(Unknown Source)
                      at java.awt.EventQueue$3.run(Unknown Source)
                      at java.awt.EventQueue$3.run(Unknown Source)
                      at java.security.AccessController.doPrivileged(Native Method)
                      at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
                      at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
                      at java.awt.EventQueue$4.run(Unknown Source)
                      at java.awt.EventQueue$4.run(Unknown Source)
                      at java.security.AccessController.doPrivileged(Native Method)
                      at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
                      at java.awt.EventQueue.dispatchEvent(Unknown Source)
                      at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
                      at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
                      at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
                      at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
                      at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
                      at java.awt.EventDispatchThread.run(Unknown Source)
      Caused by: org.jdom.JDOMException: Could not load org.apache.xerces.parsers.SAXParser: SAX2 driver class org.apache.xerces.parsers.SAXParser not found: org.apache.xerces.parsers.SAXParser
                      at org.jdom.input.SAXBuilder.createParser(SAXBuilder.java:531)
                      at org.jdom.input.SAXBuilder.build(SAXBuilder.java:424)
                      at cz.elanor.eman.Util.parseXML(SourceFile:375)
                      ... 43 more
      Caused by: org.xml.sax.SAXException: SAX2 driver class org.apache.xerces.parsers.SAXParser not found
      java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser
                      at org.xml.sax.helpers.XMLReaderFactory.loadClass(Unknown Source)
                      at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(Unknown Source)
                      at org.jdom.input.SAXBuilder.createParser(SAXBuilder.java:525)
                      ... 45 more
      Caused by: java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser
                      at java.net.URLClassLoader$1.run(Unknown Source)
                      at java.net.URLClassLoader$1.run(Unknown Source)
                      at java.security.AccessController.doPrivileged(Native Method)
                      at java.net.URLClassLoader.findClass(Unknown Source)
                      at java.lang.ClassLoader.loadClass(Unknown Source)
                      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
                      at java.lang.ClassLoader.loadClass(Unknown Source)
                      at org.xml.sax.helpers.NewInstance.newInstance(Unknown Source)
                      ... 48 more

      REPRODUCIBILITY :
      This bug can be reproduced occasionally.

      CUSTOMER SUBMITTED WORKAROUND :
      Issue can be worked around by setting correct context class loader, eg. by calling following method from event dispatch thread.

          public static void fixWebStartClassloader() {
          Thread currentThread = Thread.currentThread();
              ClassLoader myCl = Util.class.getClassLoader();
              ClassLoader contextClassLoader = currentThread.getContextClassLoader();
              if (myCl != contextClassLoader) {
                  currentThread.setContextClassLoader(myCl);
              }
          }

            dmarkov Dmitry Markov
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: