You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Erik Price <ep...@ptc.com> on 2003/08/13 22:34:00 UTC
[digester] No such accessible method
Hi,
I've been happily using Digester for about six months now, but suddenly
it's stopped working for me and I just can't figure out why. I'm hoping
someone on this list can point out my mistake.
I instantiate a digester instance, push an object instance onto it (of
type "com.ptc.oatmeal.Criteria") and call a gamut of methods on the
Criteria. This works fine. But one of the methods throws an
IOException, and when I catch this exception, unwrap it, and log it, it
is this:
2140 [main] DEBUG org.apache.commons.beanutils.MethodUtils - Matching
name=setParentRequirementId on class com.ptc.oatmeal.Criteria
2140 [main] DEBUG org.apache.commons.beanutils.MethodUtils - Found
matching name:
2140 [main] DEBUG org.apache.commons.beanutils.MethodUtils - public
void com.ptc.oatmeal.Criteria.setParentRequirementId(int)
2140 [main] DEBUG org.apache.commons.beanutils.MethodUtils -
Param=java.lang.String
2140 [main] DEBUG org.apache.commons.beanutils.MethodUtils - Method=int
2140 [main] DEBUG org.apache.commons.beanutils.MethodUtils - int is not
assignable from class java.lang.String
2140 [main] DEBUG org.apache.commons.beanutils.MethodUtils - No match
found.
2156 [main] ERROR org.apache.commons.digester.Digester - End event
threw exception
java.lang.NoSuchMethodException: No such accessible method:
setParentRequirementId() on object: com.ptc.oatmeal.Criteria
at
org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:250)
at org.apache.commons.digester.CallMethodRule.end(CallMethodRule.java:505)
How do I cast the String in my XML file (which is simply a number) to an
integer so I can pass it to the "setParentRequirementId" method?
Thanks,
Erik
Re: [digester] No such accessible method
Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Wed, 13 Aug 2003, Erik Price wrote:
> Date: Wed, 13 Aug 2003 16:34:00 -0400
> From: Erik Price <ep...@ptc.com>
> Reply-To: Jakarta Commons Users List <co...@jakarta.apache.org>
> To: Jakarta Commons Users List <co...@jakarta.apache.org>
> Subject: [digester] No such accessible method
>
> Hi,
>
> I've been happily using Digester for about six months now, but suddenly
> it's stopped working for me and I just can't figure out why. I'm hoping
> someone on this list can point out my mistake.
>
Usually, this sort of message is caused by one of the following problems
-- without seeing the source to your Criteria class, there's no way to
know which issue is actually causing this. Look for:
* The Criteria class must be public.
* The setParentRequirementId() method must be pubic and (it looks like)
take an int parameter.
* There must be no other setParentRequirementId() method that takes a
different type of parameter. In other words, "parentRequirementId"
must be a proper JavaBeans property with the usual getter and setter
method names, or you can use a BeanInfo class to explicitly specify
the getter and setter method names to use.
Craig
Re: [digester] No such accessible method
Posted by Erik Price <ep...@ptc.com>.
Erik Price wrote:
> How do I cast the String in my XML file (which is simply a number) to an
> integer so I can pass it to the "setParentRequirementId" method?
Pardon me, I somehow missed this overload of the
org.apache.commons.digester.Digester class. I used a single-element
Class[] array with "java.lang.Integer" and it worked.
Erik