commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Sanders <sand...@apache.org>
Subject Re: [Digester] java.lang.NoSuchMethodException: No such accessible method: add() on object: org.apache.commons.digester.ObjectCreateRule
Date Sat, 09 Nov 2002 01:13:48 GMT
On Fri, Nov 08, 2002 at 05:05:15PM +0100, Tomasz Klaudel wrote:
> Hi,
> 
> I have rules like this:
> <?xml version="1.0"?>
> <digester-rules>
> <pattern value="dml">
>    <object-create-rule classname="DmlMap">
>     <pattern value="select">
>        <object-create-rule classname="Select" />
>        <call-method-rule pattern="nazwa" methodname="setNazwa" 
> paramcount="0" />
>        <call-method-rule pattern="body" methodname="setBody" 
> paramcount="0" />
> 	<call-method-rule pattern="bindparam" methodname="setParam" 
> paramcount="2" />
>        <call-method-rule pattern="bindparam/lp" paramnumber="0" />
>        <call-method-rule pattern="bindparam/value" paramnumber="1" />
>        <set-next-rule methodname="putDml" paramtype="Select"/>
>     </pattern>
>    </object-create-rule>
> </pattern>
> </digester-rules>
> 
> and I parse this :
> 
> File input = new File("test.xml");
> File rules = new File("test2.xml");
> Digester digester = DigesterLoader.createDigester( rules.toURL() );
> DmlMap dm = (DmlMap)digester.parse( input );
> 
> and I get:
> java.lang.NoSuchMethodException: No such accessible method: add() on 
> object: org.apache.commons.digester.ObjectCreateRule
> 
>
<snip/>
 
> What's wrong?
> 

It looks like your rules should look like this:
(note that the object-create-rule does NOT contain anything else)


 <?xml version="1.0"?>
 <digester-rules>
     <pattern value="dml">
        <object-create-rule classname="DmlMap"/>
     </pattern>
     <pattern value="select">
        <object-create-rule classname="Select" />
        <call-method-rule pattern="nazwa" methodname="setNazwa" 
 paramcount="0" />
        <call-method-rule pattern="body" methodname="setBody" 
 paramcount="0" />
 	<call-method-rule pattern="bindparam" methodname="setParam" 
 paramcount="2" />
        <call-method-rule pattern="bindparam/lp" paramnumber="0" />
        <call-method-rule pattern="bindparam/value" paramnumber="1" />
        <set-next-rule methodname="putDml" paramtype="Select"/>
     </pattern>
 </digester-rules>
-- 
Scott Sanders - sanders@apache.org

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message