commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicolas.CHALUM...@arsoe-trelaze.com
Subject Réf. : AW: [digester] interface and setter
Date Thu, 28 Aug 2003 10:16:07 GMT
I try your solution but I still have the same error 
"java.lang.NoSuchMethodException: No such accessible method:..."
With :
Class [] params = {com.arso.trelaze.socle.persistance.Reader.class};
digester.addCallMethod( "acces/reader", "setReader", 1, params );
digester.addCallParam( "acces/reader", 0, true );

The error occurs even if I specify our not the params kind. 

At the moment I found an alternative which work. I use 
digester.addSetNext( "acces/reader", "setReader" ); rather than an 
addCallMethod . It is a fonctionnal solution but not really elegant.

So if some one have a better way ...

Nicolas





"Carsten Kaiser" <Carsten.Kaiser@valtech.de>
28/08/2003 11:34
Veuillez répondre à "Jakarta Commons Users List"

 
        Pour :  "Jakarta Commons Users List" <commons-user@jakarta.apache.org>
        cc : 
        Objet : AW: [digester] interface and setter


So I think the problem is, that the CallMethod rule does not expect any 
parameters
since you have specified: 
          1. no parameters 
          2. there is no body text to retrieve the parameter value from
 
I guess it will help, if you specify 
 
          1. digester.addCallMethod("access/reader", "setReader", 1);
          2. digester.addCallParam("access/reader", 0, true);
 
so that your RWClass instance will be taken from the stack to tell the
call method rule to invoke setReader(RWClass) respectively 
setReader(Object) 
later on.
 
Hope this solves your problem!!!
 
Regards,
CK
 
 
 
-----Ursprüngliche Nachricht----- 
Von: Nicolas.CHALUMEAU@arsoe-trelaze.com 
[mailto:Nicolas.CHALUMEAU@arsoe-trelaze.com] 
Gesendet: Do 28.08.2003 10:46 
An: Jakarta Commons Users List 
Cc: 
Betreff: [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
 
 ---------------------------------------------------------------------
                 To unsubscribe, e-mail: 
commons-user-unsubscribe@jakarta.apache.org
                 For additional commands, e-mail: 
commons-user-help@jakarta.apache.org
 
 


---------------------------------------------------------------------
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