You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "Lawrence E. Freil" <le...@apago.com> on 2004/03/12 22:10:56 UTC

Multi-threaded Java and DocumentBuilderFactory

Hello,

I am encounering an odd problem with xerces-j (2.6.0 and 2.6.2).  I have 
an application that
starts out as a multithreaded C program and subsequently creates a Java 
VM (1.4.2_01) for parsing
and handling of XML documents.  Each of the C threads registers with the 
java VM and can call
various java classes successfully.  The oddity is after I call 
"DocumentBuilderFactory.newInstance()"
from any thread,  No other thread can call it successfully.  The error 
returned is:

Exception in thread "Thread-0" 
javax.xml.parsers.FactoryConfigurationError: Provider 
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found
        at 
javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:99)
        at XMLEncodeURI.exec(XMLEncodeURI.java:71)

The origonal calling thread can continue to call this function to create 
instances of the document builder,
but no others can.  If I save the origonal returned factory in a static, 
then the other threads can reference this
same builder without problems and everything works as expected, however 
I would rather avoid having a
global static class around for this purpose. 

Any ideas on what is happening here?

Lawrence Freil
lef@freil.com



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org