[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xerces-j-user
Subject:    Loading Xerces 2 with your own ClassLoader
From:       "Mike Spreitzer" <mspreitz () us ! ibm ! com>
Date:       2002-04-30 18:19:55
[Download RAW message or body]

Is there a way to use your own java.lang.ClassLoader to succesfully load 
and use Xerces-J 2?  Specifically, I'd like to construct a 
java.net.URLClassLoader from URLs for Xerces-J 2, and use that to load 
Xerces.  I can successfully do that much, but when I try to actually use 
the loaded Xerces to get some parsing done, I get an exception.  The 
exception is involved in the dynamic classloading stuff involved with the 
XNI "parser configuration" stuff, which I do not fully understand.  Here 
is a typescript:

C:\mspreitz\src\wsstk\design\configs>java -classpath 
c:\mspreitz\src\wsstk\design\boot.jar com.ibm.wsstk.common.WsstkBoot -fp 
c:\xml4j-4_0_1\xerces.jar;c:\xml4j-4_0_1\xmlParserAPIs.jar;c:\xml4j-4_0_1\xercesImpl.jar 
-x com.ibm.wsstk.common.Workspace axis-b1.stc 
urls[0] = file:/c:/xml4j-4_0_1/xerces.jar
urls[1] = file:/c:/xml4j-4_0_1/xmlParserAPIs.jar
urls[2] = file:/c:/xml4j-4_0_1/xercesImpl.jar
org.apache.xerces.util.ObjectFactory$ConfigurationError: Provider 
org.apache.xerces.parsers.StandardParserConfiguration not found
        at 
org.apache.xerces.util.ObjectFactory.newInstance(ObjectFactory.java:298)
        at 
org.apache.xerces.util.ObjectFactory.createObject(ObjectFactory.java:237)
        at 
org.apache.xerces.util.ObjectFactory.createObject(ObjectFactory.java:119)
        at org.apache.xerces.parsers.DOMParser.<init>(DOMParser.java:109)
        at 
com.ibm.wsstk.common.LocatedElementImpl.readXml(LocatedElementImpl.java:201)
        at 
com.ibm.wsstk.common.WorkspaceDefinition.fromUri(WorkspaceDefinition.java:74)
        at com.ibm.wsstk.common.Workspace.main(Workspace.java:249)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.ibm.wsstk.common.WsstkBoot.main(WsstkBoot.java:76)

Can I fix this by fiddling with XNI stuff (my code currently does no such 
thing, as you might guess from the stack trace above)?  Would this be a 
consequence of a basic Java security mistake (my code currently does not 
set a SecurityManager)?

My application works if I use Xerces 1 instead of Xerces 2.  But I would 
rather use Xerces 2.

Thanks,
Mike

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic