struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Hardy <ahardy.str...@cyberspaceroad.com>
Subject Re: Validator classes and validator-rules.xml
Date Mon, 08 Mar 2004 21:55:16 GMT
On 03/08/2004 12:02 PM Chris Searle wrote:
> I'm getting an odd exception:
> 
> 2004-03-08 11:19:41,405 ERROR [org.apache.commons.validator.Validator] reflection: org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object,
org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest)
> java.lang.NoSuchMethodException: org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object,
org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest)
>        at java.lang.Class.getMethod(Class.java:978)
>         at org.apache.commons.validator.Validator.executeValidationMethod(Validator.java:501)
>         at org.apache.commons.validator.Validator.validateFieldForRule(Validator.java:424)
>         at org.apache.commons.validator.Validator.validateField(Validator.java:669)
>         at org.apache.commons.validator.Validator.validate(Validator.java:745)
>         at org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorForm.java:150)
> 
> The parameter list shown in the NoSuchMethodException appears to match
> the validator-rules.xml file:
> 
>      <validator name="required"
>             classname="org.apache.struts.validator.FieldChecks"
>                method="validateRequired"
>          methodParams="java.lang.Object,
>                        org.apache.commons.validator.ValidatorAction,
>                        org.apache.commons.validator.Field,
>                        org.apache.struts.action.ActionMessages,
>                        javax.servlet.http.HttpServletRequest"
>                   msg="errors.required"/>
> 
> apart from the fourth parameter (ActionMessages vs ActionErrors) but
> this is probably OK since ActionErrors is a subclass of
> ActionMessages.
> 
> This parameter list also matches the javadoc.
> 
> NB: This is the Nightly Build binary download !!! I can't recall why -
> just that I had a bug in the stable build that was fixed in the
> nightly's. However - I've just changed from the old nightly to
> 20040306 (20040307 seems to be 163 bytes long) to test - and the same
> problem with validation occurs.

I think I might have had this and found that changing to ActionMessages 
did solve it, even though it seems unnecessary.  This was one of last 
week's builds. I don't think that reflection process takes inheritance 
into account.
Adam
-- 
struts 1.1 + tomcat 5.0.16 + java 1.4.2
Linux 2.4.20 Debian


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message