Bug 222044 - ClassCastException initializing org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser
Summary: ClassCastException initializing org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXP...
Status: NEW
Alias: None
Product: Orbit
Classification: Tools
Component: bundles (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P4 normal (vote)
Target Milestone: ---   Edit
Assignee: Orbit Bundles CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-10 09:27 EDT by Linda Damus CLA
Modified: 2016-08-11 15:21 EDT (History)
2 users (show)

See Also:


Attachments
JUnit test that demonstrates the problem (6.75 KB, application/x-zip-compressed)
2008-03-10 09:51 EDT, Linda Damus CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Linda Damus CLA 2008-03-10 09:27:17 EDT
A ClassCastException occurs when initializing the org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser class via org.apache.batik.dom.svg.SAXSVGDocumentFactory#createDocument when using the IBM JRE (1.5 or 1.6) with org.apache.xerces_2.9.0.v200801282000.jar in the target environment

The exception does not occur if you:
1. use the Sun JRE, or
2. use the IBM JRE, but remove org.apache.xerces_2.9.0.v200801282000.jar from the target environment.

I have attached a unit test that demonstrates the problem.  Use the IBM JRE, and the target environemnt should consist of:

a) Eclipse full SDK 3.4M5 (win32), and 
b) the following bundles from Orbit build S20080209163815:

javax.xml_1.3.4.v200801282000.jar
org.apache.batik.css_1.6.0.v200802090005.jar
org.apache.batik.dom.svg_1.6.0.v200802090005.jar
org.apache.batik.dom_1.6.0.v200802090005.jar
org.apache.batik.ext.awt_1.6.0.v200802090005.jar
org.apache.batik.parser_1.6.0.v200802090005.jar
org.apache.batik.util.gui_1.6.0.v200711021015.jar
org.apache.batik.util_1.6.0.v200802090005.jar
org.apache.batik.xml_1.6.0.v200802090005.jar
org.apache.xerces_2.9.0.v200801282000.jar
org.apache.xml.resolver_1.2.0.v200801282000.jar
org.apache.xml.serializer_2.7.1.v200801282000.jar
org.w3c.css.sac_1.3.0.v200711021015.jar
org.w3c.dom.smil_1.0.0.v200711021015.jar
org.w3c.dom.svg_1.1.0.v200802090005.jar

To run the unit test, import the attached xercesTest.zip and select Debug As > JUnit Plug-in Test from the XercesTest context menu.  

Note that the exception that's thrown is an IOException with the message "SAX2 driver class org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser does not implement XMLReader," which is misleading.  The XMLReader#createXMLReader interprets all ClassCastExceptions to mean the parser doesn't implement XMLReader.   However, the the JAXPSAXParser does implement XMLReader, but there's a ClassCastException during initialization, as per the following stack trace, which can be seen if you set a breakpoint for all ClassCastExceptions:

Thread [main] (Suspended (exception ClassCastException))
SAXParserImpl$JAXPSAXParser(SAXParser).<init>(SymbolTable, XMLGrammarPool) line: not available	
SAXParserImpl$JAXPSAXParser(SAXParser).<init>() line: not available	
SAXParserImpl$JAXPSAXParser.<init>() line: not available	
Class<T>.newInstanceImpl() line: not available [native method]	
Class<T>.newInstance() line: 1243	
NewInstance.newInstance(ClassLoader, String) line: not available	
XMLReaderFactory.loadClass(ClassLoader, String) line: not available	
XMLReaderFactory.createXMLReader(String) line: not available	
SAXSVGDocumentFactory(SAXDocumentFactory).createDocument(InputSource) line: not available	
SAXSVGDocumentFactory(SAXDocumentFactory).createDocument(String, String, String, InputSource) line: not available	
SAXSVGDocumentFactory.createDocument(String, InputStream) line: not available	
XercesTest.test(String) line: 34	
XercesTest.testJAXPSAXParser() line: 23	
...
Comment 1 Linda Damus CLA 2008-03-10 09:51:37 EDT
Created attachment 92039 [details]
JUnit test that demonstrates the problem
Comment 2 David Williams CLA 2008-04-09 23:49:55 EDT
I was able to reproduce. I'll try to take a look, but if anyone has any ideas/knowledge of these batik interactions, let me know. 
Comment 3 David Williams CLA 2008-11-03 02:19:29 EST
Just to document it, it seems Sun's 1.6 VM also has problems running this test case. 

Comment 4 David Williams CLA 2009-03-07 15:36:07 EST
I'm setting to P4, not so say it's not important, but just to admit I don't know how to fix this, might never fix it, and want to filter it out of some of my "must attend to these bugs" queries. 

If anyone has any ideas, or fixes!, please attach a patch. 

I am hoping if/when we move to batik 1.7, maybe this but bug won't occur, and we'll move to "won't fix" at that time. 

If, by chance, this ever becomes a major or blocking problem for anyone, please document that here, and we'll renew attention. 

Comment 5 David Carver CLA 2009-07-22 18:16:23 EDT
I think this is related also to some class cast exceptions we are seeing in WTP with the latest IBM JRE.  I've verified that the exceptions are only happening if an IBM JRE is installed.
Comment 6 David Williams CLA 2016-08-11 15:21:38 EDT
Doing a mass "reset to default assignee" of 21 bugs to help make clear it will (very likely) not be me working on things I had previously planned to work on. I hope this will help prevent the bugs from "getting lost" in other people's queries. Feel free to "take" a bug if appropriate.