DocumentBuilderFactory.newInstance()

Hi Guys,
I am writing a utility that does access a database table and an xml file, like the following.
public void reads(){
tableMap = readTable(tableName); // here I am making a DB connection.
xmlMap = readXML(tableName); //
public Map readXML(){
     docFact=DocumentBuilderFactory.newInstance();
     //��creates an xml document
Here the problem is while I am using that readTable function the application exits by the line �docFact=DocumentBuilderFactory.newInstance()�. and if the readTable function is not called it works fine!.
Biju.

Did you run if from GUI of from console? One of the possibilities is that your JRE is crashed (in that case it usually create a log file).

Similar Messages

  • DocumentBuilderFactory.newInstance() only works after garbage collection

    Hi all,
    I am stucked with a strange behaviour of "DocumentBuilderFactory.newInstance()".
    I use the DocumentBuilderFactory in an applet
    to parse an xml-file.
    My applet starts ok until the line 5 (newInstance) gets called.
    At this time it seems that nothing happens anymore and that
    the applet fails to continue.
    But when I open up the java console and hit
    g (garbage collection) the xml parsing continues immediatly
    and my applet completes loading and runs ok.
    1 private void genarteDomNodes() {
    2 try {
    3 // ---- Parse XML file ----
    4 DocumentBuilderFactory factory =
    5 DocumentBuilderFactory.newInstance();
    6 DocumentBuilder builder =
    7 factory.newDocumentBuilder();
    8 Document document = builder.parse(
    9 new URL(this.myModules_xml).openStream() );
    10 // ---- Get list of nodes to given element tag name ----
    11 NodeList ndList =
    12 document.getElementsByTagName("meter-group");
    13 printNodesFromList( ndList );
    14 } catch( SAXParseException spe ) {
    15 ...
    16 } catch( SAXException sxe ) {
    17 ...
    18 } catch( ParserConfigurationException pce ) {
    19 ...
    20 } catch( IOException ioe ) {
    21 ...
    22 }
    23 }

    I am still stucked with this problem. But I found out how to enable JAXP debug output for applets (setting system properties isn't allowed for applets).
    This puts somemore output to the java console. It might help someone to understand my problem. I also printed some debug messages to track down my problem.
    Following is the console output of my applet:
    URL of XML to parse = "http://10.110.132.195/c8000-modules.xml"
    entering "genarteDomNodes"
    just before calling "DocumentBuilderFactory.newInstance()"
    JAXP: find factoryId =javax.xml.parsers.DocumentBuilderFactory
    !!! at this time the applet "hangs" and nothing happens;
    until I hit the "g" button. Then applet continues immediatly and prints:
    JAXP: loaded from fallback value: com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
    JAXP: created new instance of class com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl using ClassLoader: sun.plugin.security.PluginClassLoader@32060c
    After invoking the garbage collector the applet continue to parse the xml file and runs as expected.
    Can someone help me please.

  • Weird DocumentBuilderFactory.newInstance() behaviour

    problem summary
    ==============
    jvm breaks when I call DocumentBuilderFactory.newInstance(). I suspect its something to do with security but no exception is caught in the try...catch block where DocumentBuilderFactory.newInstance() is called.
    Other info about the problem
    ======================
    I'm working on an application that use 'presence service' and message queue service. When I use Sun's message queue service, jvm doesn't break. But when I use a SKype client (jskype) jvm always fail even though jskype doesn't reference DocumentBuilderFactory.newInstance() at all. Anyone?

    That's great thinking Fred.
    I've working on a much cut down and simplified version with just program changes to find out the cause of the behaviour.
    I tried your note off suggestion without success, but your comment on the original multi being "blocked" led me to route the final events to a second copy of the multi instrument rather than the original, and it works - the custom bank changes are correctly output!
    Maybe there's some kind of internal message validation or something, I'm not quite sure. But using a second copy of the multi instrument - though not ideal - is a perfectly acceptible workaround.
    So thanks for the pointer - you really helped me out..!

  • DocumentBuilderFactory.newInstance(); OR TransformerFactory.newInstance();

    Usually when we create a reference to an class, we'll do:
    Test tst = new Test();
    But when we create a DocumentBuilderFactory or a TransformerFactory, we use:
    DocumentBuilderFactory.newInstance();
    or
    TransformerFactory.newInstance();
    Why use the newInstance() instead?
    Thanks
    Scott

    Those are "factory" classes (as you might guess from their names). The DocumentBuilderFactory's newInstance() method returns an object that is an instance of DocumentBuilderFactory. If you read the documentation for the method, you will see the logic it goes through to decide which class it will produce an instance of.
    This allows the user to configure the choice of DocumentBuilderFactory by changing the environment, rather than by having to modify source code and recompile.

  • DocumentBuilderFactory.newInstance().newDocumentBuilder() error

    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?

    Yes, somewhere in your code you have a compile error. I'm guessing you're using Eclipse and running your code from within it (or at least, running the Eclipse compiled classes from the command line).
    You need to go and fix the compiler error. You already have all the information you need. You know where it is, you know what it is, and the documentation confirms it.

  • How to set a new DocumentBuilderFactory in my application?

    Hello Suners,
    I really need some help to set a new DocumentBuilderFactory in my application.
    I have a new instance of DocumentBuilderFactory with my settings and i need to set it in the application so that it use it to show some special DOM elements.
    DocumentBuilderFactory.newInstance("com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl", null) ;now i just need a clue how to make it recognizable to my application i mean how to make my application obtain a reference to the new DocumentBuilderFactory so it can use the factory to configure and obtain parser instances?.
    Edited by: abulseed on Aug 29, 2010 6:59 AM

    abulseed wrote:
    now i just need a clue how to make it recognizable to my application i mean how to make my application obtain a reference to the new DocumentBuilderFactory so it can use the factory to configure and obtain parser instances?.That code already produces a reference to the new DocumentBuilderFactory (assuming it's correct code). The normal thing to do with the reference would be to assign it to a variable. Then your application could use the variable, which refers to the factory, to do those things which it is supposed to do.

  • Error while creating DocumentBuilderFactory object for parsing XML string

    When I try to execute the following statement in an EJB class,
    DocumentBuilderFactory df=DocumentBuilderFactory.newInstance();
    I get the following exception:
    javax.xml.parsers.FactoryConfigurationError: Provider org.apache.crimson.jaxp.DocumentBuilderFactoryImpl not found
    When the same statement is executed from a standalone java class, it works fine.
    The IDE used is Visual Age for Java.
    The JAXP package used is JAXP 1.0.1
    Can anybody please let me know how can we overcome this problem?
    Thanks and Regards,
    Shashi Anand B
    E-Mail : [email protected]

    javax.xml.parsers.FactoryConfigurationError: Provider
    org.apache.crimson.jaxp.DocumentBuilderFactoryImpl not
    foundI suspect that this may be due to a classpath issue and/or a Java version issue. Doe your Visual Age installation use Java 1.3? Do you have Sun Java 1.4 also installed on your system? It may be that when you are executing from a standalone Java class, that you are using the Java 1.4 runtime, which include the org.apach.crimson.* classes. Earlier version of Java do not include this, although it may be in the JAXP package.
    I think that your Visual Age IDE is configured such that the DocumentBuilderFactory is unable to find the appropriate implementation.
    I hope this helps!
    - David

  • TransformerFactory.newInstance cannot be resolved to a type"

    Hi Techies,
    i am writing simple application for creation of XML using java,
    but while compiling i am getting the following error
    "Exception in thread "main" java.lang.Error: Unresolved compilation problem:
         TransformerFactory.newInstance cannot be resolved to a type"
    can any one help me to solve this error..
    thanks in advance

    hey here the code goes
    package src;
    import java.io.*;
    import javax.xml.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.parsers.*;
    import javax.xml.transform.*;
    import javax.xml.transform.dom.*;
    import javax.xml.transform.stream.*;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    public class XMLCreator {
         * @param args
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              try{
                   BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
                   System.out.println("Enter the number of elements");
                   String str = bf.readLine();
                   int no = Integer.parseInt(str);
                   System.out.println("Enter root: ");
                   String root = bf.readLine();
                   DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                   DocumentBuilder db = dbf.newDocumentBuilder();
                   Document doc = db.newDocument();
                   Element rootElement = doc.createElement(root);
                   doc.appendChild(rootElement);
                   for(int i=1;i<=no;i++){
                        System.out.println("Enter the data");
                        String element = bf.readLine();
                        System.out.println("Enter data");
                        String data = bf.readLine();
                        Element em = doc.createElement(element);
                        em.appendChild(doc.createTextNode(data));
                        rootElement.appendChild(em);
                        TransformerFactory tf = new TransformerFactory.newInstance();
                        Transformer tr = tf.newTransformer();
                        DOMSource domsrc = new DOMSource(doc);
                        StreamResult res = new StreamResult(System.out);
                        tr.transform(domsrc, res);
              }catch (Exception e) {
                   // TODO: handle exception
    }

  • ParserConfigurationException with javax.xml.parsers.DocumentBuilderFactory

    Like many people, I am trying to just read in the contents of a XML file. My code compiles in WS studio and I publish it to the server. However, I keep getting a ParserConfigurationException when I try to get a DocumentBuilder from the factory. Below is my code:
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    try {
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document document = builder.parse( new File(XMLFILE) );
    Any idea why?

    The xmlfile is valid and here is the partial stacktrace
    Root Error-1: javax/xml/parsers/ParserConfigurationException
    java.lang.Exception: javax/xml/parsers/ParserConfigurationException
    at Search5F_Results_jsp_5._jspService(_Search_5F_Results_jsp_5.java:206)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:127)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:390)
    at org.apache.jasper.runtime.JspServlet.serviceJspFile
    Do I need to set some system property?

  • Contents of META-INF/services/javax.xml.parsers.DocumentBuilderFactory?

    I am currently working on an applet that solves Sudoku puzzles, allowing you to build your own in a Constructor and then solve them in a seperate Solver. To do this, we are implementing the puzzles files as XML documents.
    I have the code completely complied and on the server ( [sudoku.unl.edu|sudoku.unl.edu]) and it runs NEARLY perfectly, however when trying to access the server to save the xml code, the apache error_log presents this message: "File does not exist: classes/META-INF/services
    /javax.xml.parsers.DocumentBuilderFactory"
    Looking at the Java Doc here it says that the program should look for that in the jars. I am unsure of exactly how the applet is interacting with the server, but typing "java -version" yields:
    java version "1.6.0_11"
    Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
    Java HotSpot(TM) 64-Bit Server VM (build 11.0-b16, mixed mode)Notably, the code works PERFECTLY in NetBeans, contacting the server using SCP and uploading the file and such, so the code doesn't seem to be the problem, unless I need to direct the DocumentBuilder code somehow. This is the code that I believe is causing the trouble (I have tried to include all relevant imports that are in my code):
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.xml.sax.SAXException;
    DocumentBuilderFactory factoryBuilder;
              DocumentBuilder builder;
              Document doc;
              Element docElement;
              try
                   factoryBuilder  = DocumentBuilderFactory.newInstance( );
                   builder = factoryBuilder.newDocumentBuilder();
                   doc = builder.parse( indexLocation );
                   docElement = doc.getDocumentElement();
                   NodeList children = docElement.getChildNodes();          
                   for(int i =0; i < children.getLength(); i++)
                        if(children.item(i).getNodeType() == 1)
                             if((children.item(i).getNodeName()).equals("directory"))
                                  if ((children.item(i).getAttributes().getNamedItem("name").getNodeValue()).equals("UsersInput")) {
                                       Node firstChild = findNodeItem(children.item(i), "Difficulty0.." + this.upperField.getText());
                                       Node secondChild = findNodeItem(firstChild, "Level" + this.levelField.getText());
                                       Node thirdChild = findNodeItem(secondChild, (String)suTypeList.getSelectedItem());
                                       Element newFile = doc.createElement("file");
                                       newFile.setAttribute("name", fileName);                              
                                       thirdChild.appendChild(newFile);                              
                   SshParameters params = new SshParameters("cse.unl.edu", "consystlab","A/tutti");
                // create new Scp instance
                Scp scp = new Scp(params);
                // register event listener
                scp.addListener(this);
                // establish connection
                scp.connect();
                   TransformerFactory tFactory = TransformerFactory.newInstance();
                   Transformer transformer = tFactory.newTransformer();
                   DOMSource source = new DOMSource(doc);
                   StringWriter sw=new StringWriter();
                   StreamResult result = new StreamResult(sw);
                   transformer.transform(source, result);
                   String xmlString=sw.toString();
                // upload file
                  scp.upload(xmlString.getBytes(), indexPath, "libraryIndex.xml");
                 // disconnect
                scp.disconnect();
              catch (IOException e)
                   System.out.println("IO ERROR7");
                   System.out.println(e);
              catch (TransformerException tranE){
                   tranE.printStackTrace();               
              catch (ParserConfigurationException e)
                   System.out.println("IO ERROR8");
                   System.out.println(e);
              catch (SAXException e)
                   System.out.println("IO ERROR9");
                   System.out.println(e);
              }So my question is, what exactly are the contents of the file in the META-INF/services folder? I have manually created this file in my classes directory, where the program is searching. When I place text in it, it appends the text with .class and searches for that file, but doesn't seem to do anything with the file. I attempted directing it to the "DocumentBuilderFactory.class" file that I extracted from the classes.jar included with the JDK.
    I feel like all I need is this file to contain the correct content and the code will FINALLY work, but I have not been able to find anything out there on it.
    Thank for you for your help, sorry this was such a long message.
    -Jason

    Thanks!
    Thanks for the fast reply. I don't know if I made my point clear.
    I do not want to determine the parser by myself. I want the client system use the default parser, so I do not have the hit of downloading the fairly large parser jar.
    However, I want it not to do an empty request to the server for nothing. This turn around time kills an Applet. I want a fast loading applet!
    I'll go in trial and error mode, when I find the time next week.
    Thanks again, I appreciate it!
    K<o>

  • Help w..TransformerFactoryConfigurationError:  newInstance(Unknown Source)

    When I tried this servlet example apache-tomcat-5.5.17 using java version "1.5.0_07"
    javax.servlet.ServletException: Servlet execution threw an exception
    root cause
    javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found
         javax.xml.transform.TransformerFactory.newInstance(Unknown Source)
         XML2HTMLServlet.openFile(XML2HTMLServlet.java:31)
         XML2HTMLServlet.doGet(XML2HTMLServlet.java:19)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    // XML2HTMLServlet.java
    //http://forum.java.sun.com/thread.jspa?forumID=34&threadID=260273
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.xml.transform.*;
    import javax.xml.transform.dom.*;
    import javax.xml.parsers.*;
    import org.w3c.dom.*;
    import org.xml.sax.*;
    public class XML2HTMLServlet extends HttpServlet {
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException {
    response.setContentType("text/html");
    PrintWriter writer = response.getWriter();
    try {
    openFile("file:/apps/tomcat/apache-tomcat-5.5.17/webapps/xml/financials.xml", "file:/apps/tomcat/apache-tomcat-5.5.17/webapps/xml/financials.xsl", writer);
    } catch (Exception e) {
    e.printStackTrace(writer);
    private void openFile(String xmlPath, String xslPath, PrintWriter writer)
    throws IOException, ParserConfigurationException, SAXException,
    TransformerConfigurationException, TransformerException {
    File xmlFile = new File(xmlPath);
    File xslFile = new File(xslPath);
    TransformerFactory tFact = TransformerFactory.newInstance();
    DocumentBuilderFactory dbFact = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = dbFact.newDocumentBuilder();
    Document xmlDoc = builder.parse(xmlFile);
    Document xslDoc = builder.parse(xslFile);
    Node xmlDocNode = (Node)xmlDoc;
    Node xslDocNode = (Node)xslDoc;
    DOMSource xmlSrc = new DOMSource(xmlDocNode);
    DOMSource xslSrc = new DOMSource(xslDocNode);
    DOMResult htmlResult = new DOMResult();
    Transformer transformer = tFact.newTransformer(xslSrc); // the exception occurs here!
    }

    Setting the proerty work now , I get no display, just a
    When I tried this servlet example
    apache-tomcat-5.5.17 using java version "1.5.0_07"
    javax.servlet.ServletException: Servlet execution
    threw an exception
    root cause
    javax.xml.transform.TransformerFactoryConfigurationErr
    or: Provider
    org.apache.xalan.processor.TransformerFactoryImpl not
    found
         javax.xml.transform.TransformerFactory.newInstance(Un
    known Source)
         XML2HTMLServlet.openFile(XML2HTMLServlet.java:31)
         XML2HTMLServlet.doGet(XML2HTMLServlet.java:19)
         javax.servlet.http.HttpServlet.service(HttpServlet.ja
    va:689)
         javax.servlet.http.HttpServlet.service(HttpServlet.ja
    va:802)
    // XML2HTMLServlet.java
    //http://forum.java.sun.com/thread.jspa?forumID=34&thr
    eadID=260273
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.xml.transform.*;
    import javax.xml.transform.dom.*;
    import javax.xml.parsers.*;
    import org.w3c.dom.*;
    import org.xml.sax.*;
    public class XML2HTMLServlet extends HttpServlet {
    System.setProperty("javax.xml.transform.TransformerFactory", "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws IOException, ServletException {
    response.setContentType("text/html");
    PrintWriter writer = response.getWriter();
    try {
    penFile("file:/apps/tomcat/apache-tomcat-5.5.17/webapp
    s/xml/financials.xml",
    "file:/apps/tomcat/apache-tomcat-5.5.17/webapps/xml/fi
    nancials.xsl", writer);
    } catch (Exception e) {
    e.printStackTrace(writer);
    private void openFile(String xmlPath, String
    xslPath, PrintWriter writer)
    throws IOException,
    ParserConfigurationException, SAXException,
    TransformerConfigurationException,
    TransformerException {
    File xmlFile = new File(xmlPath);
    File xslFile = new File(xslPath);
    TransformerFactory tFact =
    TransformerFactory.newInstance();
    DocumentBuilderFactory dbFact =
    DocumentBuilderFactory.newInstance();
    DocumentBuilder builder =
    dbFact.newDocumentBuilder();
    Document xmlDoc =
    builder.parse(xmlFile);
    Document xslDoc =
    builder.parse(xslFile);
    Node xmlDocNode = (Node)xmlDoc;
    Node xslDocNode = (Node)xslDoc;
    DOMSource xmlSrc = new
    DOMSource(xmlDocNode);
    DOMSource xslSrc = new
    DOMSource(xslDocNode);
    DOMResult htmlResult = new
    DOMResult();
    Transformer transformer =
    tFact.newTransformer(xslSrc); // the exception
    occurs here!

  • ClassCastException in DocumentBuilderFactory on DB-Server

    Hi,
    I've deployed an application, that recieves a xml-String to parse.
    It's running fine in JDeveloper but when I deploy it to the Database
    I recieve the ClassCastException.
    I figured out that it's thrown when I do:
    DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
    Whats the problem with the DocumentBuilderFactory?
    Any Suggestions?
    THX
    Selim Keser

    Have you loaded the same version of the Oracle XDK for Java into the database account where you're trying to run this?

  • [Solution] DocumentBuilderFactory, Serialization, and WL 8.1 SP 2

    <pre>
    Hello All!
    I finally have gotten my web services to work properly. All of my serialization
    woes were caused by my using the javax.xml.parsers.DocumentBuilderFactory and
    NOT setting the following options:
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setValidating(false);
    factory.setNamespaceAware(true);
    Yup. That's it. I saw this being done in one of the tech support people's examples:
    private Document getDocumentWithWL(String resourceName)
    throws Exception
    weblogic.apache.xerces.parsers.DOMParser parser = new weblogic.apache.xerces.parsers.DOMParser();
    parser.setFeature(
    "http://apache.org/xml/features/dom/defer-node-expansion",
    false );
    parser.setFeature( "http://xml.org/sax/features/validation",
    false);
    parser.setFeature( "http://xml.org/sax/features/namespaces",
    true);
    parser.setFeature( "http://apache.org/xml/features/validation/schema",
    true);
    parser.parse(new org.xml.sax.InputSource(this.getClass().getClassLoader().getResourceAsStream(resourceName)));
    return(parser.getDocument());
    and decided to write the analog to this using the DocumentBuilderFactory:
    private Document getDocumentWithDB(String resourceName)
    throws Exception
    DocumentBuilder db = null;
    DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance();
    // Set params
    fac.setValidating(false);
    fac.setNamespaceAware(true);
    db = fac.newDocumentBuilder();
    Document doc = db.parse(this.getClass().getClassLoader().getResourceAsStream(resourceName));
    return(doc);
    Now my doc/lit web services are able to marshall data between the service and
    client. I have to still use the DII dynamic proxy client method for invoking
    the web service (SOAPElement!! grr).
    Thanks to all who helped diagnose this problem. You know that you have this problem
    when you see errors about "Local name of attribute can not be null ...." coming
    out of weblogic's XML serialization code.
    Hope this helps someone else out there
    -- jake
    </pre>

    Well basically that means there was a partial message that came in over a socket, and the server waited 60 seconds for the rest of the message, but it never arrived.
    Was the server, or a client under heavy load? Did you notice any response time problems?
    -- Rob
    WLS Blog http://dev2dev.bea.com/blog/rwoollen/

  • Do Apache servers not like DocumentBuilderFactory ?

    An exciting problem for all java geeks !
    Here is a very simple "Hello World" applet initializing a dumy instance of the DocumentBuilderFactory class: (XML DOM parser)
    // DBFBugApt.java
    import java.applet.Applet ;
    import java.awt.* ;
    import javax.xml.parsers.*;
    public class DBFBugApt extends Applet {
       public void init() {
          DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); // May fail on some servers !
       public void paint (Graphics g)  {
            g.drawString("Hello world !", 25, 75);
    }Here is the listing of the DBFBugApt.html file displaying this applet:
    <html>
    <head>
    <title>DocumentBuilderFactory bug ?</title>
    </head>
    <body>
    <p>DBFBugApt says: (may fail when hosted on some servers !)</p>
    <p>
    <applet code="DBFBugApt.class" width="250" height="100">
    </applet>
    </p>
    </body>
    </html>This applet has been compiled with JDK 1.5.0_01 and deployed here: http://www.culand.ch/dev/DBFBugApt.html
    As you can see, it works fine displaying "Hello World !" as expected...
    The same DBFBugApt.class and DBFBugApt.html files have then been installed here: http://www.freewebs.com/softquipeut/DBFBugApt.html
    And surprise: this alternate deployment fail to initialise ! The applet throws a NoClassDefFoundError error during its initialisation on the following statement: DocumentBuilderFactory.newInstance();Find hereafter the java console log:
    java.lang.NoClassDefFoundError: IllegalName: <HTML><title>FreeWebs - Page Not Found</title>
         at java.lang.ClassLoader.preDefineClass(Unknown Source)
         at java.lang.ClassLoader.defineClass(Unknown Source)
         at java.security.SecureClassLoader.defineClass(Unknown Source)
         at sun.applet.AppletClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at javax.xml.parsers.FactoryFinder.newInstance(Unknown Source)
         at javax.xml.parsers.FactoryFinder.findJarServiceProvider(Unknown Source)
         at javax.xml.parsers.FactoryFinder.find(Unknown Source)
         at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source)
         at DBFBugApt.init(DBFBugApt.java:13)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    The question I'm trying to answer for one week without getting any logical explanation is WHY ???
    The most remarkable difference between this two hosting web servers is the following:
    My personal web site http://www.culand.ch is hosted on a Cobalt web server while www.freewebs.com sites are hosted on Apache servers.
    For different reasons, I suspect all Apache web servers not to support hosting applets performing such DocumentBuilderFactory.newInstance() statement.
    Or said differently: JRE 1.5.0_01 implementation of the DocumentBuilderFactory class does not support to be invoked by an applet hosted on an Apache server !!!
    Is that a bug of the JRE 1.5.0_01 or a misconfiguration of the www.freewebs.com Apache web servers ?
    If you have an available Apache Web server, you can help me to decide this by installing this applet on your server and letting me know if it works or not.
    DBFBugApt.class, DBFBugApt.html (and the source file DBGBugApt.java too) can all be downloaded from each of the two given web servers.
    If this is confirmed to be related to the Apache web servers only, and no misconfiguration of the web server can be found, I will report this as a JRE bug to Sun !
    Thank you to help me solving this !
    And I'm offering 10 Dollar Duke reward for a solution because I'm tired of this *@!$%! problem...
    Thanks again to all of you who will answer to this thread.
    P.F. Culand

    The issue is not with the type of server, but with
    the specific configuration of the freewebs server.
    The DBF tries to load a file
    "META-INF/services/javax.xml.parsers.DocumentBuilderFa
    ctory" from the classpath, which, in this case, is
    the directory on your server. The freewebs server
    does not return a HTTP 404 error for a non-existing
    resource like a proper little webserver, but instead
    returns a HTTP 200 and a (human-readable) error page,
    which the DBF tries to parse, resulting in the error.
    Note that this is NOT Apache default behaviour, any
    server can be configured thus, although it violates
    the HTTP protocol.
    2 possible solutions:
    - configure the freewebs server properly
    - pack your app into a jar fileSince the first solution is not in my hand I opted for the 2nd one:
    It seems not to work, but I may have done something wrong in packing my applet into a jar file... (not very experimented in that).
    So here is what I did:
    I made the jar file by executing the following batch file:
    set JavaDir=C:\Program Files\Java\Jdk1.5.0_01\
    set ClassPath=.;%JavaDir%lib\classes.zip;%JavaDir%lib\
    "%JavaDir%bin\jar" cvf DBFBugApt.jar DBFBugApt.classI modified the DBFBugApt.html file by adding an archive attribute to the applet tag that way:
    <html>
    <head>
    <title>DocumentBuilderFactory bug ?</title>
    </head>
    <body>
    <p>DBFBugApt says: (may fail when hosted on some servers !)</p>
    <p>
    <applet archive="DBFBugApt.jar" code="DBFBugApt.class" width="250" height="100">
    </applet>
    </p>
    </body>
    </html>I deleted the old DBFBugApt.class
    I first tried to display the new html file from my local directory with the MSIE browser... It worked.
    I uploaded the new jar and html files on the working Cobalt server on my personal web site: http://www.culand.ch/dev/DBFBugApt.html and deleted the old class file. Then I tested it... It worked.
    Finally I uploaded them the same way on the freewebs server (http://www.freewebs.com/softquipeut/DBFBugApt.html) and deleted the old class file too. Then I tested it... DOES NOT WORK !
    The loading of the applet is much slower than before and in hangs notinited like before... The console log is the following: (exactly the same than before)
    java.lang.NoClassDefFoundError: IllegalName: <HTML><title>FreeWebs - Page Not Found</title>
         at java.lang.ClassLoader.preDefineClass(Unknown Source)
         at java.lang.ClassLoader.defineClass(Unknown Source)
         at java.security.SecureClassLoader.defineClass(Unknown Source)
         at sun.applet.AppletClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at javax.xml.parsers.FactoryFinder.newInstance(Unknown Source)
         at javax.xml.parsers.FactoryFinder.findJarServiceProvider(Unknown Source)
         at javax.xml.parsers.FactoryFinder.find(Unknown Source)
         at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source)
         at DBFBugApt.init(DBFBugApt.java:13)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)Did I make something wrong ?
    Why do you thing that packing the applet into a jar file would solve the problem ?
    Any suggestion ?
    It is driving me to despear...!
    Thanks for your help, the thread stays open.
    P.F. Culand

  • Which properties file should be modified for DocumentBuilderFactory

    I am creating a Document object using the following lines of code. Unfortunately, the DocumentBuiderFactory, by default looks for a namespace org.xml.... Which means that I get a parsing error when I am not connected to the net. Can someone point out which properties file needs to be modified to prevent this error from occuring.
    // Build the request document
    DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = builderFactory.newDocumentBuilder();
    Document response = builder.parse(in);
    Thanks in advance
    Jimmy

    Did you ever figure this problem out? If so, could you provide me with some advice about it?

Maybe you are looking for

  • Reporting Services Webpart - web part does not auto render consistantly

    We are on SharePoint 2010 (integrated with Reporting Services)- on several sites we have added the Reporting Services Web Part and with a saved parameter.  The behavior of this web part is not consistent.  There are times when I open up a site and th

  • Grey Screen, won't boot from usb. Only have a PC to create a boot USB. How can I reinstall OSX with a .dmg file?

    I recently recieved a macbook that I was told was broken. She didn't know what was wrong with it, but she told me I could keep it if I wanted to get it working again. Its http://support.apple.com/kb/sp579 this model. I got the laptop to power on, but

  • Vectorial map viewer

    Hello, I'm looking for a MIDP library to view vectorial map (viewer). I found out the open source tiny SVG library for SVG format. Does anybody knows if there are other tools handling other map formats than the SVG one? (e.g. Flash) Thank you and Reg

  • ITunes is not working with the 7.1 upgrade!

    My iTunes did the automatic upgrade 7.1.0.59 and it stop working. It was working perfect befored this upgrade. Now I open iTunes it loads up fine but when I try to listen to my music an error comes up ( iTunes has encountered a problem and needs to c

  • Upgrade to Lion and no way to open finder

    After Lion upgrade, I can not open any folder or searching through finder... i click on a folder of my desktop and it disappears. I can only see for few seconds moving from one screen to another in Expose mode, but no way to click on it. I see the li