You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by opentotech <op...@googlemail.com> on 2007/04/27 11:05:39 UTC

Beanutils.copyproerties problem

Hi techies,

I have a problem with Beanutils.copyproperties. I have a jsp with a
<html:select multiple="true" property="practices"/> I know in action I will
be getting an array of practices. I am using LazyValidatorForm. In my GP
object I have an array of practices. Practice[] practices. I am using
Beanutils.copyproperties to copy from form to GP object. But I am getting
the following error:

java.lang.IllegalArgumentException: Cannot invoke
com.mwcs.par.Gp.setPractices - argument type mismatch
        at
org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1778)
        at
org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:1759)
        at
org.apache.commons.beanutils.BeanUtilsBean.copyProperty(BeanUtilsBean.java:447)
        at
org.apache.commons.beanutils.BeanUtilsBean.copyProperties(BeanUtilsBean.java:236)
        at
org.apache.commons.beanutils.BeanUtils.copyProperties(BeanUtils.java:114)
        at
com.mwcs.controller.admin.GpAddEditDoneAction.execute(GpAddEditDoneAction.java:31)
        at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
        at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
        at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
        at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
        at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
        at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
        at
org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
        at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
        at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
        at
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
        at java.lang.Thread.run(Thread.java:595)

can anyone help me out to solve this problem. I have searched many forums
and I cant find an answer for this.

Thanks in advance friends,

Sony
-- 
View this message in context: http://www.nabble.com/Beanutils.copyproerties-problem-tf3656485.html#a10215566
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Beanutils.copyproerties problem

Posted by Laurie Harper <la...@holoweb.net>.
opentotech wrote:
> Hi techies,
> 
> I have a problem with Beanutils.copyproperties. I have a jsp with a
> <html:select multiple="true" property="practices"/> I know in action I will
> be getting an array of practices. I am using LazyValidatorForm. In my GP
> object I have an array of practices. Practice[] practices. I am using
> Beanutils.copyproperties to copy from form to GP object. But I am getting
> the following error:
> 
> java.lang.IllegalArgumentException: Cannot invoke
> com.mwcs.par.Gp.setPractices - argument type mismatch
>
 > [...]
> 
> can anyone help me out to solve this problem. I have searched many forums
> and I cant find an answer for this.

There's not enough information here to solve the problem. What argument 
type does setPractices() expect? What does your form class look like? 
How are you using BeanUtils.copyProperties?

My guess is that you're trying to pass String-based form data into 
something that expects typed data -- e.g. you're trying to set a String 
array on something that wants a Practice array or something similar.

In that case, you would need to create and register a BeanUtils 
converter class that knows how to go from String to Practice (or 
whatever the case may be).

L.


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