tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank W. Zammetti" <fzli...@omnytex.com>
Subject Re: using digester from within a servlet
Date Mon, 24 Apr 2006 03:48:12 GMT
It looks to me like your ObjectCreate rule is incorrect... I believe the 
class you reference must be the fully-qualified name.  For instance, 
look at this source as an example:

http://cvs.sourceforge.net/viewcvs.py/javawebparts/javawebparts/WEB-INF/src/javawebparts/taglib/ajaxtags/AjaxInit.java?view=markup

Here you see lines like:

digester.addObjectCreate("ajaxConfig/handler",
   "javawebparts.taglib.ajaxtags.config.AjaxHandler");

Although I can't find anyplace in the documentation where it's 
explicitly stated (I'm betting I'm just missing it though), looking at 
the Digester Javadoc here:

http://jakarta.apache.org/commons/digester/commons-digester-1.7/docs/api/

The example code also shows fully-qualified names.  The same looks to be 
true of setNext by the way, and I suspect anywhere a class name is 
required.

Give that a try and see if it solves your problem.  I can tell you wish 
certainty that I've used Digester in a servlet under Tomcat and not had 
any problems.

Frank

Marc Farrow wrote:
> I have no knowledge of digesters, but if you are wanting Tomcat (the engine
> itself) to use a class, then it has to be in the common/lib folder and not
> deployed with the webapp.   Not sure if this is the direction you want to go
> or not.
> 
> hth
> 
> 
> On 4/23/06, Christopher Piggott <chrisp@rochester.rr.com> wrote:
>>
>> Hi,
>>
>> My goal is to use digester within a servlet, to parse a configuration
>> file.
>> When running within the servlet context digester is unable to find the
>> classes specified by my rules.  For example, I have this set of rules to
>> process an element <xdb-config> which occurs within a <config> element:
>>
>>   digester.addObjectCreate("config/xdb-config", XdbConfig.class);
>>   digester.addSetProperties("config/xdb-config", "database-name",
>> "databaseName");
>>   digester.addSetNext("config/xdb-config", "addXdbConfig", "XdbConfig");
>>
>> What I get is this:
>>
>> Apr 23, 2006 10:21:29 PM org.apache.commons.digester.CallMethodRule
>> setDigester
>> SEVERE: (CallMethodRule) Cannot load class XdbConfig
>> java.lang.ClassNotFoundException: XdbConfig
>>
>>
>> I get this other places as well.  One of the things I find odd is that
>> this
>> error occurs after the above one in the error log:
>>
>> Apr 23, 2006 10:21:29 PM org.apache.commons.digester.CallMethodRule
>> setDigester
>> SEVERE: (CallMethodRule) Cannot load class Config
>> java.lang.ClassNotFoundException: Config
>>
>>
>> Basically, the class loader seems to be able to load my classes from
>> within
>> my own classes, but NOT from the digester.  What I don't understand is how
>> that's possible when the required classes are clearly within the
>> classpath;
>> I upload them to tomcat as a .war and they are all exploded into
>> WEB-INF/classes.  I can't see how this could not be in the classpath and
>> therefore not found by the digester.
>>
>> --Chris
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
> 
> 
> --
> Marc Farrow

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: fzammetti@hotmail.com
Java Web Parts -
http://javawebparts.sourceforge.net
Supplying the wheel, so you don't have to reinvent it!

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message