You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mohit Gupta <mo...@gmail.com> on 2014/06/23 12:37:03 UTC
NoSuchMethodException: while struts action method call ?
I am hitting the customerAction (struts 2 action) from my legacy action
with url
customer/customer-creater!create.action?custId=200
As soon call goes to my customerAction i get below error
ognl.MethodFailedException: Method "setCustId" failed for object
com.actions.customer.CustomerCreateAction@c175e10
[java.lang.NoSuchMethodException:
com.actions.customer.CustomerCreateAction.setCustId([Ljava.lang.String;)]
private int custId = -1;
public void setCustId(int custId) {
this.custId = custId;
}
Struts somehow searching for setCustId with string parameter where method
exist with int parameter. As per my understanding struts 2
internally does type conversion. So i am not sure why i am getting this
issue?
Re: NoSuchMethodException: while struts action method call ?
Posted by Mohit Gupta <mo...@gmail.com>.
Thanks Lukasz. I am already doing that. I found issue was parameters were
passed twice with same name. removed extra one. Its working fine.
On Tue, Jun 24, 2014 at 1:12 PM, Lukasz Lenart <lu...@apache.org>
wrote:
> Struts2 filter isn't used during FORWARD, you must explicite configure
> it to do so:
>
> <filter-mapping>
> <filter-name>strits2</filter-name>
> <url-pattern>/*</url-pattern>
> <dispatcher>REQUEST</dispatcher>
> <dispatcher>FORWARD</dispatcher>
> </filter-mapping>
>
> 2014-06-23 13:17 GMT+02:00 Mohit Gupta <mo...@gmail.com>:
> > Actually when i am redirecting from legacy action to
> > customer/customer-creater!create.action?custId=200, struts
> > 2 successfully does type conversion but not while forwarding the request
> to
> > same url though same struts2 filter comes in to picture. Any ideas what
> > the issue ?
> >
> >
> > On Mon, Jun 23, 2014 at 4:07 PM, Mohit Gupta <mo...@gmail.com> wrote:
> >
> >> I am hitting the customerAction (struts 2 action) from my legacy action
> >> with url
> >> customer/customer-creater!create.action?custId=200
> >>
> >> As soon call goes to my customerAction i get below error
> >>
> >> ognl.MethodFailedException: Method "setCustId" failed for object
> >> com.actions.customer.CustomerCreateAction@c175e10
> >> [java.lang.NoSuchMethodException:
> >>
> com.actions.customer.CustomerCreateAction.setCustId([Ljava.lang.String;)]
> >>
> >> private int custId = -1;
> >>
> >> public void setCustId(int custId) {
> >> this.custId = custId;
> >> }
> >>
> >>
> >> Struts somehow searching for setCustId with string parameter where
> method
> >> exist with int parameter. As per my understanding struts 2
> >> internally does type conversion. So i am not sure why i am getting this
> >> issue?
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Re: NoSuchMethodException: while struts action method call ?
Posted by Lukasz Lenart <lu...@apache.org>.
Struts2 filter isn't used during FORWARD, you must explicite configure
it to do so:
<filter-mapping>
<filter-name>strits2</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
2014-06-23 13:17 GMT+02:00 Mohit Gupta <mo...@gmail.com>:
> Actually when i am redirecting from legacy action to
> customer/customer-creater!create.action?custId=200, struts
> 2 successfully does type conversion but not while forwarding the request to
> same url though same struts2 filter comes in to picture. Any ideas what
> the issue ?
>
>
> On Mon, Jun 23, 2014 at 4:07 PM, Mohit Gupta <mo...@gmail.com> wrote:
>
>> I am hitting the customerAction (struts 2 action) from my legacy action
>> with url
>> customer/customer-creater!create.action?custId=200
>>
>> As soon call goes to my customerAction i get below error
>>
>> ognl.MethodFailedException: Method "setCustId" failed for object
>> com.actions.customer.CustomerCreateAction@c175e10
>> [java.lang.NoSuchMethodException:
>> com.actions.customer.CustomerCreateAction.setCustId([Ljava.lang.String;)]
>>
>> private int custId = -1;
>>
>> public void setCustId(int custId) {
>> this.custId = custId;
>> }
>>
>>
>> Struts somehow searching for setCustId with string parameter where method
>> exist with int parameter. As per my understanding struts 2
>> internally does type conversion. So i am not sure why i am getting this
>> issue?
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: NoSuchMethodException: while struts action method call ?
Posted by Mohit Gupta <mo...@gmail.com>.
Actually when i am redirecting from legacy action to
customer/customer-creater!create.action?custId=200, struts
2 successfully does type conversion but not while forwarding the request to
same url though same struts2 filter comes in to picture. Any ideas what
the issue ?
On Mon, Jun 23, 2014 at 4:07 PM, Mohit Gupta <mo...@gmail.com> wrote:
> I am hitting the customerAction (struts 2 action) from my legacy action
> with url
> customer/customer-creater!create.action?custId=200
>
> As soon call goes to my customerAction i get below error
>
> ognl.MethodFailedException: Method "setCustId" failed for object
> com.actions.customer.CustomerCreateAction@c175e10
> [java.lang.NoSuchMethodException:
> com.actions.customer.CustomerCreateAction.setCustId([Ljava.lang.String;)]
>
> private int custId = -1;
>
> public void setCustId(int custId) {
> this.custId = custId;
> }
>
>
> Struts somehow searching for setCustId with string parameter where method
> exist with int parameter. As per my understanding struts 2
> internally does type conversion. So i am not sure why i am getting this
> issue?
>