JDK-6350682 : REGRESSION: SAXParserFactory throws FactoryConfigurationError if contextClassLoader=null
  • Type: Bug
  • Component: xml
  • Sub-Component: org.xml.sax
  • Affected Version: 6
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux,windows_xp
  • CPU: x86
  • Submitted: 2005-11-15
  • Updated: 2012-04-25
  • Resolved: 2006-07-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b92Fixed
Related Reports
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.6.0-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-rc-b60)
Java HotSpot(TM) Client VM (build 1.6.0-rc-b60, mixed mode, sharing)

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

A DESCRIPTION OF THE PROBLEM :
SAXParserFactory.newInstance() throws FactoryConfigurationError if in current contextClassLoader=null. Version 1.5_04, 1.5_05 works ok. As result of this change of the behaviour, maven tool can't work under mustang.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run example

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
SAXParserFactory.newInstance() expected to use system loader when there is no context one.
ACTUAL -
Exception is thrown

ERROR MESSAGES/STACK TRACES THAT OCCUR :
C:\>java -showversion -Djaxp.debug=1 JAXPTest
java version "1.6.0-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-rc-b60)
Java HotSpot(TM) Client VM (build 1.6.0-rc-b60, mixed mode, sharing)

JAXP: find factoryId =javax.xml.parsers.SAXParserFactory
JAXP: found jar resource=META-INF/services/javax.xml.parsers.SAXParserFactory using ClassLoader: nul
l
JAXP: found in resource, value=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
Exception in thread "main" javax.xml.parsers.FactoryConfigurationError: Provider com.sun.org.apache.
xerces.internal.jaxp.SAXParserFactoryImpl could not be instantiated: java.lang.NullPointerException
        at javax.xml.parsers.SAXParserFactory.newInstance(Unknown Source)
        at JAXPTest.main(JAXPTest.java:8)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.xml.parsers.SAXParserFactory;

public class JAXPTest
{
 public static void main(String[] args) throws Exception
 {
  Thread.currentThread().setContextClassLoader(null);
  SAXParserFactory.newInstance();
 }
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Don't set context class loader to null.

Release Regression From : 5.0u5
The above release value was the last known release where this 
bug was known to work. Since then there has been a regression.

Comments
EVALUATION To answer mvfranz's SDN comment: This issue was fixed in b92 for Sun JDK1.6.0. Apple maintains their own JDK for OS X. You may want to contact Apple for the issue. Thanks.
2008-05-28

EVALUATION this bug has undergone an internal review to avoid classloader issues and is being accepted.
2006-06-20