• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

problem with BeanUtils.copyProperties

 
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,
I am having an error while copying the values of the form in to the persitent class, and the error is argument type mismatch:

11:43:54,389 WARN [RequestProcessor] Unhandled Exception thrown: class java.lang.IllegalArgumentException
11:43:54,399 WARN [jbossweb] WARNING: Exception for /hdatas/currency.do?action=create
java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)
at org.apache.commons.beanutils.BeanUtils.copyProperty(BeanUtils.java:450)
at org.apache.commons.beanutils.BeanUtils.copyProperties(BeanUtils.java:239)
at com.b2b.datas.web.action.CurrencyAction.create(CurrencyAction.java:126)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:278)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:218)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:465)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:523)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360)
at org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:342)
at com.b2b.datas.filters.SessionChecking.doFilter(SessionChecking.java:50)
at org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:334)
at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:86)
at org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:334)
at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:286)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:558)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1714)
at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:507)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1664)
at org.mortbay.http.HttpServer.service(HttpServer.java:863)
at org.jboss.jetty.Jetty.service(Jetty.java:460)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:775)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:939)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:792)
at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:201)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:455)

The above is the error and the corresponding struts-config piece of code is as follows

<form-bean name="currencyForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="companyNo" type="java.lang.String"/>
<form-property name="currencyKey" type="java.lang.String"/>
<form-property name="currencyText" type="java.lang.String"/>
<form-property name="conversionFactorCustomer" type="java.lang.Double"/>
<form-property name="conversionFactorVendor" type="java.lang.Double"/>
<form-property name="conversionFactorGLAccount" type="java.lang.Double"/>
<form-property name="conversionFactorControlling" type="java.lang.Double"/>
<form-property name="conversionFactorReserve1" type="java.lang.Double"/>
<form-property name="conversionFactorReserve2" type="java.lang.Double"/>
<form-property name="conversionFactorReserve3" type="java.lang.Double"/>
<form-property name="dateLastValuation" type="java.lang.String"/>
<form-property name="status" type="java.lang.String"/>
</form-bean>

I am using hibernate and the fields companyNo and currencyKey together are the primary keys which form the composite key in the .hbm.xml. and the piece of code is as follows

<composite-id>
<key-property name="companyNo" column="CompanyNo" type="string" length="20"/>
<key-property name="currencyKey" column="CurrencyKey" type="string" length="3"/>
</composite-id>

It would be nice if an appropriate solution is found.

Thanks in advance
A.Kumar
 
reply
    Bookmark Topic Watch Topic
  • New Topic