logo       

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

Subject: Re: AbstractDOMParser.setDocumentClassName() and classloaders
At 06:40 PM 4/15/2007, you wrote:
>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.
>

You're right. And I was confused. It was setting this value on my own wrapper class for DOMParser, which then sets the property the appropriate way.


>> 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.
>

Thanks for the hint. I resolved this by resetting the context class loader to the one that loaded the Ant task and setting it back again in a "finally" block before leaving the method.


Jake

>
>[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


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
boot-loaders.gr...    php.pear.genera...    debugging.valgr...    kde.redhat.user...    text.xml.xsl.ge...    culture.languag...    hardware.microc...    java.servicemix...    redhat.release....    web.zope.plone....    user-groups.lin...    opendarwin.webk...    video.mjpeg.use...    sysutils.bcfg2....    encryption.gpg....    lx-office.devel...    xfree86.forum/2...    mail.mutt.devel...    acpi.devel/2003...    qnx.openqnx.dev...    network.irc.irs...    freebsd.devel.m...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe