Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2005

Tip: Looking for answers? Try searching our database.

ExceptionInInitializerError & Xerces

Thread view: 
anthony.mak@iname.com - 04 Sep 2005 07:55 GMT
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
John Currier - 05 Sep 2005 01:07 GMT
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
anthony.mak@iname.com - 29 Sep 2005 07:01 GMT
Thanks John.
I thought it might be something this painful, ouch,
but thanks for confirming my idea. :)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.