ExceptionInInitializerError & Xerces

A

anthony.mak

I have the following codes to parse xml using xerces and I think when I
have line #2
and line #3 I got ExceptionInInitializerError as shown bellow. The
error message
is not very helpful, could anyone give me some ideas why I got this
error?

I also notice when includes all the xerces files in my jar file I had
no error, but if
I let JBuilder's deployment wizard to include only files that are
necessary, I got
the error but the error message does not give me any ideas which files
I am missing.

Anthony

#### CODE #######

DOMParser parser = new DOMParser();
=> parser.setFeature("http://xml.org/sax/features/validation",
true);
=>
parser.setFeature("http://apache.org/xml/features/validation/schema",
true);
parser.setFeature(

"http://apache.org/xml/features/validation/schema-full-checking",
true);
Validator handler = new Validator();
parser.setErrorHandler(handler);

parser.parse(xmlfile.getAbsolutePath());

if (handler.validationError == true) {
JOptionPane.showMessageDialog(this, "XML Document is not
valid");
handler.saxParseException.printStackTrace(System.out);
throw new SAXParseException("XML Document is not valid",
null);
}
else {
System.out.println("XML Document is valid");
}

##### ERROR MESSAGE ######

Exception in thread "AWT-EventQueue-0"
java.lang.ExceptionInInitializerError
at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:27)
at
java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at java.lang.Class.newInstance0(Class.java:350)
at java.lang.Class.newInstance(Class.java:303)
at org.apache.xerces.util.ObjectFactory.newInstance(Unknown
Source)
at
org.apache.xerces.impl.dv.SchemaDVFactory.getInstance(Unknown Source)
at
org.apache.xerces.impl.dv.SchemaDVFactory.getInstance(Unknown Source)
at
org.apache.xerces.impl.xs.SchemaGrammar$BuiltinSchemaGrammar.<init>(U
nknown Source)
at org.apache.xerces.impl.xs.SchemaGrammar.<clinit>(Unknown
Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.<init>(Unknown

Source)
at
org.apache.xerces.parsers.IntegratedParserConfiguration.configurePipe
line(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.reset(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown
Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at twbgui.TwbGui.loadXML(TwbGui.java:906)
at twbgui.TwbGui.loadGraph(TwbGui.java:701)
at twbgui.TwbGui$8.actionPerformed(TwbGui.java:348)
at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:18
49)
at
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.jav
a:2169)
at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
..java:420)
at
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258 )
at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
at
javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1
000)
at
javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMen
uItemUI.java:1041)
at java.awt.Component.processMouseEvent(Component.java:5488)
at
javax.swing.JComponent.processMouseEvent(JComponent.java:3093)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212 )
at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at
java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:234)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:163)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at
java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Caused by: java.lang.RuntimeException: internal error
at
org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl.applyFacets1(Unknown So
urce)
at
org.apache.xerces.impl.dv.xs.SchemaDVFactoryImpl.createBuiltInTypes(U
nknown Source)
at
org.apache.xerces.impl.dv.xs.SchemaDVFactoryImpl.<clinit>(Unknown Sou
rce)
... 46 more
 
J

John Currier

JBuilder is likely not seeing some dependencies that exist because
Xerces is using reflection to resolve classes.

Add the classes from your working jar into the JBuilder's dependencies
list (however you do that) until it works.

John Currier
http://schemaspy.sourceforge.net
 
A

anthony.mak

Thanks John.
I thought it might be something this painful, ouch,
but thanks for confirming my idea. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top