You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Ni...@arsoe-trelaze.com on 2003/08/28 10:46:57 UTC

[digester] interface and setter

I have a class that have 2 private attributes Reader and Writer who define 
getter and setter methodes

I use an factory to instanciate attributes class. I define it like this : 

<acces name="SuivitServices">
      <reader classe="com.arso.trelaze.socle.persistance.RWClass"/>
      <writer classe="com.arso.trelaze.socle.persistance.RWClass"/>
</acces>

I call factories for the reader and writer to instanciate the good class : 

digester.addFactoryCreate( "acces/reader", 
                            "com.arso.trelaze.socle.persistance.ReaderFactory" );

It works perfect I get an RWClass who implement both the reader interface 
and the writer interface.
But when I try to call the setter void setReader(Reader reader) with the 
rule : 
digester.addCallMethod( "acces/reader", "setReader", 0 );
I had the following error : 

java.lang.NoSuchMethodException: No such accessible method: setReader() on 
object: com.arso.trelaze.socle.persistance.RWClass
        at 
org.apache.commons.digester.Digester.createSAXException(Digester.java:2383)
        at 
org.apache.commons.digester.Digester.createSAXException(Digester.java:2409)
        at 
org.apache.commons.digester.Digester.endElement(Digester.java:1067)
        at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown 
Source)
        at 
org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown 
Source)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown 
Source)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown 
Source)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 
Source)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown 
Source)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown 
Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown 
Source)
        at org.apache.commons.digester.Digester.parse(Digester.java:1600)
        at 
com.arso.trelaze.socle.persistance.ConfigurationLoader.chargerConfiguration(ConfigurationLoader.java:90)

I think it was an introspection error : it try to find a void 
setReader(RWClass reader) and don't find it but how could I do to make 
digester calling the good setter ? 
I try to define it has void setReader(Object reader) but I had the same 
error.

I am new to digester so sorry if it is an evidence for you.

thanks
Nicolas