File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes IllegalArgumentException:  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 "IllegalArgumentException:  argument type mismatch" Watch "IllegalArgumentException:  argument type mismatch" New topic

IllegalArgumentException: argument type mismatch

Peter Vennel
Ranch Hand

Joined: Dec 18, 2003
Posts: 46
I am getting the following exception while submitting my form.

Error Stack Trace

I have located the line of code which triggers this. It is in the second line of jsp code below :

If I mask that line, then I do not get this error. I am not sure what's going wrong here.

Above all, the Multiselect list box gets properly loaded with the values I set in my action class.

My code snippets are as below :
Nate Leech
Ranch Hand

Joined: Feb 07, 2005
Posts: 43
<html: OptionsCollection property="planList" label="columnName" value="columnCd"/>

Not 100% sure, but I think you need to use name="planList" instead of property ="planList"

Hope this works!

Fisher Daniel
Ranch Hand

Joined: Sep 14, 2001
Posts: 582
I ussually using code like this

hope this help and correct me if I am wrong

Peter Vennel
Ranch Hand

Joined: Dec 18, 2003
Posts: 46
Thanks Guys.

But my tag syntax is correct in all respect. Infact I have used it in the past without any problems.

In , the form bean contains an array of objects in the property planList that we want the label and values to come from. (Ref. Struts KickStart - Tuener & Bedell)

This is some other issue.

Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

Your tag is trying to call getPlanList() on your ActionForm. Your code shows getPlanList() in the bean.

And judging by the error type, I believe your ActionForm might have a getPlanList() but with parameters. Otherwise the error would be that no method was found.

A good workman is known by his tools.
Peter Vennel
Ranch Hand

Joined: Dec 18, 2003
Posts: 46
Thanks Marc.

My ActionForm does not have any getPlanList() with parameters. It only has getPlanList() with no parameters.

Peter Vennel
Ranch Hand

Joined: Dec 18, 2003
Posts: 46
Found the problem!

In the above, the variable <authorizedPlans> was defined by me as ArrayList in the form. While debugging, I found out that it should be of type String[].

I feel the error logging of struts is not that good. I had not clue that this was the variable causing the problem.

Anyway, the problem has been resolved.

Thanks to all for your help.


[ February 16, 2005: Message edited by: Peter Vennel ]
[ February 16, 2005: Message edited by: Peter Vennel ]
mohamed zafer
Ranch Hand

Joined: Nov 03, 2000
Posts: 62
I am facing a similar problem

<nested:select multiple="true" property="answer">
<nested:nest property="options">
<nested:iterate property="option">
<option value='<nested:write property="property" />'><nested:write property="labelProperty" /></option><br>

The property "answer" is a string array, still i get the same error "java.lang.IllegalArgumentException: argument type mismatch" on submitting

Any idea

I agree. Here's the link:
subject: IllegalArgumentException: argument type mismatch
jQuery in Action, 3rd edition