4 Replies Latest reply: Aug 27, 2010 1:32 PM by 843790 RSS

    DocumentBuilderFactory.newInstance().newDocumentBuilder() error

    843790
      import javax.xml.parsers.DocumentBuilder;
      import javax.xml.parsers.DocumentBuilderFactory;
      import org.w3c.dom.*;
      public class FrameRecorder extends Thread {
           public Document dmt;
           public FrameRecorder() {
                DocumentBuilderFactory fctry = DocumentBuilderFactory.newInstance();
                fctry.setValidating(true);
                fctry.setNamespaceAware(true);
                fctry.setIgnoringElementContentWhitespace(true);
      //the error is on the next line.
                DocumentBuilder bldr = fctry.newDocumentBuilder();
           }
      }

      When I run it, I get an error saying:

      Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problem:
           Unhandled exception type ParserConfigurationException

           at FrameRecorder.<init>(FrameRecorder.java:11)
           at BaseFrame.<init>(BaseFrame.java:17)
           at Base.createGUI(Base.java:10)
           at Base$1.run(Base.java:7)
           at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:226)
           at java.awt.EventQueue.dispatchEvent(EventQueue.java:602)
           at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275)
           at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200)
           at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
           at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
           at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
           at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)

      I don't know what to do to fix this.
      I'm running 64-bit Ubuntu 10.4 so could it be a compatibility problem? The only headway I could make was that .newDocumentBuilder() throws a ParserConfigurationException (that's the error I'm getting), and the docs tell me that .newDocumentBuilder() throws this when it "DocumentBuilder cannot be created which satisfies the configuration requested".

      Any help?