logo       

Related Msgs: audio.musicbrai...    enbd.general/20...    ietf.idr/2002-0...    java.ant-contri...    gnu.make.genera...    qplus.devel/200...    video.freevo.cv...    os.netbsd.ports...    yellowdog.gener...    xfree86.cvs/200...    search.nutch.us...    freedesktop.xse...    programming.swi...    capabilities.ge...    telephony.pbx.a...    mail.sylpheed.c...    db.firebase.por...    boot-loaders.u-...    recreation.radi...    netbsd.bugs/200...    web.zope.plone....    user-groups.lin...   

Re: AbstractDOMParser.setDocumentClassName() and classloaders: msg#00022

Subject: Re: AbstractDOMParser.setDocumentClassName() and classloaders
Hi Jake,

Jacob Kjome <hoju@xxxxxxxx> wrote on 04/15/2007 07:08:01 PM:

> I've got a parser extending DOMParser and call 
> parser.setDocumentClassName(MetaDataDocument.class.getName()) .

This method gets called during reset. Your own code probably shouldn't be 
calling it. Setting the "document-class-name" property [1] is the 
supported way to override the default Document implementation.

> The problem is, the class MetaDataDocument is in a child classloader and 

> Xerces reports that it can't find it.....
> 
>       [xmlc] Error: java.lang.IllegalArgumentException: 
> MissingDocumentClassName:
>   The class name of the document factory 
> "org.enhydra.xml.xmlc.metadata.MetaDataDocument" used to construct 
> the DOM tree could not be found.
>       [xmlc] java.lang.IllegalArgumentException: 
> MissingDocumentClassName: The class name of the document factory 
> "org.enhydra.xml.xmlc.metadata.MetaDataDocument" used to construct 
> the DOM tree could not be found.
> 
> As you may recognize, this is in the context of an Ant 
> task.  Specifically, the XMLC Ant task.  Ant includes XercesImpl.jar 
> in ANT_HOME/lib.  My library is added to the taskdef via a 
> <classpath> element.  I know Xerces runs through some fancy routines 
> to find classloaders, but it doesn't seem to be doing the job 
> here.  I'm wondering if you have any suggestions to resolve this issue?

Is the child ClassLoader which knows how to load MetaDataDocument the 
current thread's context ClassLoader? That's where Xerces looks.

> Up to now, I've wrapped Xerces in my own namespace and added it to 
> the <classpath> declaration in the build file.  Now I'm trying to 
> utilize XercesImpl.jar already included on the classpath (such as in 
> Ant and most J2EE containers).  This is keeping me from being able to 
> utilize the global instance and resort to using my own version 
> packaged with my library.  I hope there is a way to resolve this!
> 
> 
> Jake
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xxxxxxxxxxxxxxxxx
> For additional commands, e-mail: j-users-help@xxxxxxxxxxxxxxxxx

[1] 
http://xerces.apache.org/xerces2-j/properties.html#dom.document-class-name

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@xxxxxxxxxx
E-mail: mrglavas@xxxxxxxxxx



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo