aspose file tools*
The moose likes Struts and the fly likes java.lang.Illegal Argument Exception: argument type mismatch Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "java.lang.Illegal Argument Exception: argument type mismatch" Watch "java.lang.Illegal Argument Exception: argument type mismatch" New topic
Author

java.lang.Illegal Argument Exception: argument type mismatch

jayanthi g choudhary
Greenhorn

Joined: Apr 21, 2006
Posts: 4
i get this error whenever i submitt the form and i am totally exausted


[Servlet Error]-[BeanUtils.populate]: java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)
at org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684)
at org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713)
at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)
at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:983)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:564)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))

i have the following code in my jsp which is probably causing the error


<logic resent name="presetsClass" property="availablePresetsSubClassList">
<html:select styleClass="dataSelectField" name="presetsClass" property="availablePresetsSubClassList" size="10" style="{width=300}">
<logic:iterate id="presetsSubClass" name="presetsClass" property="availablePresetsSubClassList">
<option value="<bean:write name="presetsSubClass" property="subClassId"/>" ><bean:write name="presetsSubClass" property="subClassName"/></option>
</logic:iterate>
</html:select>
</logic resent>
jayanthi g choudhary
Greenhorn

Joined: Apr 21, 2006
Posts: 4
sorry i forgot to disable the smiles

the code in the jsp is

<logic:present name="presetsClass" property="selectedPresetsSubClassList">
<html:select styleClass="dataSelectField" name="presetsClass" property="selectedPresetsSubClassList" size="10" style="{width=300}">
<logic:iterate id="presetsSelectedSubClass" name="presetsClass" property="selectedPresetsSubClassList">
<option value="<bean:write name="presetsSelectedSubClass" property="subClassId"/>" ><bean:write name="presetsSelectedSubClass" property="subClassName"/></option>
</logic:iterate>
</html:select></logic:present><logic:notPresent name="presetsClass" property="selectedPresetsSubClassList">
<select class="dataSelectField" name="selectedPresetsSubClassList" size="10" style="{width=300}">
</select>
</logic:notPresent>
Please kindly help my code to run.......eargerly waiting for ur solutions
thanks in advance
Liju Cherian
Ranch Hand

Joined: Mar 17, 2006
Posts: 44
Jayanthi, correct me if I'm wrong, but what I've understood from the post is that selectedPresetsSubClassList is a list of bean objects.

Right..??? If that's the case how can you assign a list as the property of an <html:select/> tag. I believe the bug lies in the line shown below.

Why don't u try using a String variable as the property of the tag.

Hope this helps.


Cheers,
Liju


"What's in a name? That which we call a rose by any other name would smell just as sweet."<br />(William Shakespeare, Romeo and Juliet, Act II, Scene II)
jayanthi g choudhary
Greenhorn

Joined: Apr 21, 2006
Posts: 4
ya liju you are right but the property is an arraylist but when i retrieve the things from that property and able to show it onto the form, why i cant save it in the same way.

i have worked with the same in lot of forms , i have never faced this problem in past .

yesterday this error came when i am trying to press keys when my cursor is on the select options. But when i dont press any key and then select from the select box and submitt it then it went well.

but today unfortunately it stopped even working like that.

thanks for your adive i have tried making it as a string but its not getting iterated in the jsp, it says cannot create a collection.
Liju Cherian
Ranch Hand

Joined: Mar 17, 2006
Posts: 44
I think you mis-understood me when I asked you to change the property to a String variable. Why don't u use a different property for the <html:select/> tag altogether.


In the above code I've changed the property of the <html:select/> tag from selectedPresetsSubClassList to classId where classId is a String variable. Could u try this out..???

i have worked with the same in lot of forms , i have never faced this problem in past .

Still confused with the above though.


Cheers,
Liju
jayanthi g choudhary
Greenhorn

Joined: Apr 21, 2006
Posts: 4
hi liju

Thanks a lot , my problem is solved . I really appreciate your timely response.
jay lai
Ranch Hand

Joined: Apr 04, 2002
Posts: 180
Hello,I have the same error, but my jsp is kind of huge, so not sure which tag causing the error, any suggestion to debug the error. Is that mostly because of type of the tag in jsp is not match with the form bean

This error causing when ever i hit enter on the text field. Then it is throwing this error.
Many thanks for your help or advice.
Regards

here is the error.
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
In general it is best to use String properties in your form to represent fields that the user enters on the screen. I am pretty sure that this error is usually caused by using properties of other types (Date, Long, ...).

- Brent
Anita Ganga
Greenhorn

Joined: Oct 20, 2004
Posts: 28
I am stuck with this since few days...Having the same issue

I have to use the property in my jsp which is of type "org.apache.struts.upload.FormFile" to upload a file .Like this
<html:file property="primaryFile" maxlength="250" />

In my form I declared it as
private FormFile primaryFile ;
public void setPrimaryFile(FormFile primaryFile) {
this.primaryFile = primaryFile;
}
public FormFile getPrimaryFile() {
return primaryFile;
}
public void reset(ActionMapping mapping, HttpServletRequest request) {
this.primaryFile=null ;
}

I am getting this exception

[5/10/06 10:30:33:322 PDT] 7ff3d4d6 WebGroup E SRVE0026E: [Servlet Error]-[BeanUtils.populate]: java.lang.IllegalArgumentException: Cannot invoke com.strykercorp.e3s.stellent.forms.CheckInNewForm.setPrimaryFile - 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.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1648)
at org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:1677)
at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1022)
at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493)
at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:816)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1049)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:600)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:201)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:125)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:286)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:624)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:448)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:912)
vicky sandhu
Greenhorn

Joined: Jun 21, 2005
Posts: 3
use this enctype="multipart/form-data" in your form tag
Kamalnath Balakrishnan
Greenhorn

Joined: Mar 22, 2011
Posts: 2
Brent Sterling wrote:In general it is best to use String properties in your form to represent fields that the user enters on the screen. I am pretty sure that this error is usually caused by using properties of other types (Date, Long, ...).

- Brent



Hi

But you know that ,i take all values from FormBean I declares as a Date.. then i got the same error.....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.lang.Illegal Argument Exception: argument type mismatch