commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Cooper <mart...@apache.org>
Subject Re: Digester ClassNotFoundException
Date Sat, 14 Dec 2002 04:28:37 GMT


On Fri, 13 Dec 2002, Nannetti Simone wrote:

> Good morning,
> I work with Tomcat4.0.3 e windows NT 4.0.
> I installed in common/lib these jar: commons-beanutils.jar (v. 1.5),
> commons-collections.jar (v. 2.1), commons-logging.jar (v. 1.0.2) and
> commons-digester.jar (v. 1.3).
> Inside my servlet I coded like this:
> ============================================
>                         Digester digester = new Digester();
>                         digester.setValidating(false);

Right here, you should insert:

    digester.setUseContextClassLoader(true);

That will most likely solve your problem.

--
Martin Cooper


>
> digester.addObjectCreate("region","it.tosca.util.Region");
>
> digester.addObjectCreate("region/city","it.tosca.util.City");
>
> digester.addBeanPropertySetter("region/city/code","code");
>
> digester.addBeanPropertySetter("region/city/area","area");
>
> digester.addBeanPropertySetter("region/city/description","description");
>
> digester.addBeanPropertySetter("region/city/address","address");
>
> digester.addBeanPropertySetter("region/city/telephone","telephone");
>
> digester.addBeanPropertySetter("region/city/fax","fax");
>
> digester.addBeanPropertySetter("region/city/email","email");
>                         digester.addSetNext("region/city","addCity");
>                         File file = new
> File("/home/Sil/SilXML/info_region.xml");
>                         Region li = (Region)digester.parse(file);
>                         System.out.println(li.toString());
> =============================================================
> At runtime I caugth this error:
>
> 10 [HttpProcessor[8080][4]] ERROR digester.Digester  - Begin event threw
> exception
> java.lang.ClassNotFoundException: it.tosca.util.Region
>         at
> org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader
> .java:1127)
>         at
> org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader
> .java:992)
>         at
> org.apache.commons.digester.ObjectCreateRule.begin(ObjectCreateRule.java:252
> )
>         at
> org.apache.commons.digester.Digester.startElement(Digester.java:1237)
>         at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1449)
>         at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:499)
>         at org.apache.crimson.parser.Parser2.parse(Parser2.java:304)
>         at
> org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:433)
>         at org.apache.commons.digester.Digester.parse(Digester.java:1479)
> I solved this problem by moving commons-digester.jar from common/lib to
> webapps/Sil/WEB-INF/classes and unzip the jar in last directory.
> I think it was a Class loader problem. Is there a way for success leaving
> commons-digester.jar in common/lib?
> Do I have to use another class loader type? How can I set it?
> Can you help me?
> Best regards,
> Simone Nannetti
>
>
> --
> To unsubscribe, e-mail:   <mailto:commons-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-user-help@jakarta.apache.org>
>
>


Mime
View raw message