commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Carman" <ja...@carmanconsulting.com>
Subject RE: ClassNotFound [digester]
Date Fri, 14 Apr 2006 19:56:38 GMT
Try this:

Thread.currentThread().getContextClassLoader().loadClass(
"mycompany.service.ups.dto.UPSResponseDTO" )

Digester, by default, uses the thread context classloader.  So, if it can't
find the class, then Digester can't instantiate it.  You can optionally tell
Digester what classloader to use by calling setClassLoader().  Hope that
helps!

James

-----Original Message-----
From: Michael Rasmussen [mailto:razmaspaz@gmail.com] 
Sent: Friday, April 14, 2006 3:49 PM
To: commons-user@jakarta.apache.org
Subject: ClassNotFound [digester]

Hello,
  I am working with digester and when executing this line of code

upsResponseDTO = xmlDigester.parse(new ByteArrayInputStream(
upsResponse.getBytes()));

I get a ClassNotFoundException in digester

org.apache.commons.digester.Digester  TRAS0014I: The following exception was
logged java.lang.ClassNotFoundException:
mycompany.service.ups.dto.UPSResponseDTO
    at java.net.URLClassLoader.findClass(URLClassLoader.java(Compiled Code))
    at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java(Compiled
Code))
    at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
    at org.apache.commons.digester.ObjectCreateRule.begin(
ObjectCreateRule.java:204)
    at org.apache.commons.digester.Rule.begin(Rule.java:152)
    at org.apache.commons.digester.Digester.startElement(Digester.java:1286)
    at org.apache.xerces.parsers.AbstractSAXParser.startElement(
AbstractSAXParser.java(Compiled Code))
    at org.apache.xerces.impl.XMLNamespaceBinder.startElement(
XMLNamespaceBinder.java(Compiled Code))
    at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(
XMLDTDValidator.java(Compiled Code))
    at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(
XMLDocumentFragmentScannerImpl.java(Compiled Code))
    at
org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElem
entHook
(XMLDocumentScannerImpl.java:929)
    at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc
her.dispatch
(XMLDocumentFragmentScannerImpl.java(Compiled Code))
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(
XMLDocumentFragmentScannerImpl.java(Compiled Code))
    at org.apache.xerces.parsers.StandardParserConfiguration.parse(
StandardParserConfiguration.java:525)
    at org.apache.xerces.parsers.StandardParserConfiguration.parse(
StandardParserConfiguration.java:581)
    at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:147)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(
AbstractSAXParser.java:1158)
    at org.apache.commons.digester.Digester.parse(Digester.java:1591)
    at mycompany.service.ups.client.UPSXmlDigester.parse(UPSXmlDigester.java
:84)


I can execute the following line in the same JVM instance with no problems.

UPSResponseDTO upsRp = new UPSResponseDTO();

I have verified that the import is the same as the ClassNotFound

import mycompany.service.ups.dto.UPSResponseDTO;

Is it possible that digester uses a different classpath or classloaded for
the classloading it does?  I'm a little confused here (Actually very
confused)

Thanks,
Michael



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message