United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6350682 : REGRESSION: SAXParserFactory throws FactoryConfigurationError if contextClassLoader=null

Details
Type:
Bug
Submit Date:
2005-11-15
Status:
Resolved
Updated Date:
2012-04-25
Project Name:
JDK
Resolved Date:
2006-07-14
Component:
xml
OS:
linux,windows_xp
Sub-Component:
org.xml.sax
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports
Duplicate:
Relates:

Sub Tasks

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

this bug has undergone an internal review to avoid classloader issues and is being accepted.
                                     
2006-06-20
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



Hardware and Software, Engineered to Work Together