You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by Gary L Peskin <ga...@firstech.com> on 2001/05/11 22:57:27 UTC

Re: XMLReaderFactory/SAXParserFactory/DocumentBuilderFactory does not use getContextClassLoader

Hi, Dims --

We have a static method called getClassForName that we call whenever we
need to load an extension class.  As you said, it uses the thread's
ContextClassLoader if we're at an appropriate JDK level.  Otherwise, it
falls back to Class.forName.

We should reroute all of Xalan's Class.forName() calls through this
method, I think.  Perhaps this should be something included in
xml-commons.

If needed, I can move the method to its own class or to some
commons-type class so that it is available to all of the projects.

Gary

Davanum Srinivas wrote:
> 
> Hi All,
> 
> XMLReaderFactory/SAXParserFactory/DocumentBuilderFactory all use Class.forName() directly. This is
> going to cause problems with JDK1.4 because JAXP classes are packaged with the JRE itself.
> Switching to another parser using System Property or jaxp.properties will fail. Please correct me
> if am wrong.
> 
> We can fix the problem by trying Thread.currentThread().getContextClassLoader() to load the class
> and fall back to Class.forName() if it fails. This is the approach taken by Xalan's extension
> loading mechanism. Right Scott?
> 
> What can we do? Any suggestions? Beta for JDK1.4 is not too far...
> 
> Thanks,
> dims
> 
> PS: http://www.javageeks.com/Papers/ClassForName/DynLoad.pdf
> 
> =====
> Davanum Srinivas, JNI-FAQ Manager
> http://www.jGuru.com/faq/JNI
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - Buy the things you want at great prices.
> http://auctions.yahoo.com/
> 
> ---------------------------------------------------------------------
> In case of troubles, e-mail:     webmaster@xml.apache.org
> To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
> For additional commands, e-mail: general-help@xml.apache.org

---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org