Re: jdom2 runtime

Rolf Lear <[email protected]> Tue, 21 Aug 2012 16:32:18 -0400
Newsgroups gmane.comp.java.jdom.general
Message-ID <[email protected]>
OK, I believe the issue is an incompatible issue with crimson. I believe 
you have xrimson earlier in the classpath than xerces, as a result the 
JAXP process is choosing the crimson parser instead of xerces.

You should be able to check this by adding "-Djaxp.debug=1" to your jvm 
arguments.

Crimson is *really* old... the most recent release was in 2001.... and 
it is discontinued. Though I am surprised it even has any JAXP 
vestiges... though, checking it's documentation, it *does* support JAXP 
1.1, thus, I imagine what is happening in your case is that you have 
Crimson earlier in the classpath than xerces. As a result, the JAP API 
is finding the crimson parser ahead of the Xerces.

I recommend dropping the crimson jar from your classpath. There is 
nothing you should be needing Crimson for (and if you have 
third-party-dependencies requiring crimson then there's problems).

Alternatively, put the xerces jar at the top of the classpath.

With the fix for issue #89 (not available yet) you can specify the 
xerces JAXP factory explicitly....

For the record, the 'simple' circumstance is for there to be just one 
XML parser in your classpath... not two.

I recommend using the xerces.jar and matching xmlapis.jar only

For what it's worth, the other jars Xalan, saxon, etc, are not actual 
parsers, but rather additional XML functionality.

Rolf

On 21/08/2012 3:37 PM, Craig Christophersen wrote:
>
> Exception in thread "AWT-EventQueue-0" 
> java.lang.ExceptionInInitializerError
>
> at org.jdom2.input.SAXBuilder.<init>(_SAXBuilder.java:338_)
>
> at org.jdom2.input.SAXBuilder.<init>(_SAXBuilder.java:221_)
>
> at transform.ReadDmFile.<init>(_ReadDmFile.java:47_)
>
> at transform.TransformAction.execute(_TransformAction.java:410_)
>
> at transform.MakeBook.actionPerformed(_MakeBook.java:112_)
>
> at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
>
> at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
>
> at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
>
> at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
>
> at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown 
> Source)
>
> at java.awt.AWTEventMulticaster.mouseReleased(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$000(Unknown Source)
>
> at java.awt.EventQueue$1.run(Unknown Source)
>
> at java.awt.EventQueue$1.run(Unknown Source)
>
> at java.security.AccessController.doPrivileged(_Native Method_)
>
> at 
> java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown 
> Source)
>
> at 
> java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown 
> Source)
>
> at java.awt.EventQueue$2.run(Unknown Source)
>
> at java.awt.EventQueue$2.run(Unknown Source)
>
> at java.security.AccessController.doPrivileged(_Native Method_)
>
> at 
> java.security.AccessControlContext$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: _java.lang.UnsupportedOperationException_: This parser does 
> not support specification "null" version "null"
>
> at javax.xml.parsers.SAXParserFactory.setSchema(Unknown Source)
>
> at org.jdom2.input.sax.XMLReaders.<init>(_XMLReaders.java:122_)
>
> at org.jdom2.input.sax.XMLReaders.<clinit>(_XMLReaders.java:95_)
>
> ... 42 more
>
> Other parsers: Xalon-2.7.0.jar, xml-apis-est-1.3.04.jar, xml-apis.jar, 
> xercesImpl.jar, saxon.jar,  crimson.jar
>
> *From:*Rolf Lear [mailto:[email protected]]
> *Sent:* Tuesday, August 21, 2012 1:23 PM
> *To:* Craig Christophersen
> *Cc:* [email protected]
> *Subject:* Re: [jdom-interest] jdom2 runtime
>
> Yes, there's a real advantage to the no-arg constructor ... it's 
> simple ;-)
>
> But, it should be working. What's the error message? Is there a stack 
> trace? Do you have any other XML Parsers in your classpath?
>
> Rolf
>
> On 21/08/2012 3:10 PM, Craig Christophersen wrote:
>
>     Thanks Rolf.
>
>     I am able to run
>     *new*SAXBuilder(*new*XMLReaderSAX2Factory(*false*,
>     "org.apache.xerces.parsers.SAXParser")); OK.
>
>     I do have xercesImpl and xml-apis in my classpath.  But I cannot
>     yet get the no arg constructor (new SAXBuilder()) to run.
>
>     Is there some advantage to using the no arg constructor?
>
>     Thanks, Craig
>

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]