wood burning stoves*
The moose likes Spring and the fly likes IllegalArgumentException: Cannot convert value of type [java.lang.String] to required Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "IllegalArgumentException: Cannot convert value of type [java.lang.String] to required" Watch "IllegalArgumentException: Cannot convert value of type [java.lang.String] to required" New topic
Author

IllegalArgumentException: Cannot convert value of type [java.lang.String] to required

Vyas Sanzgiri
Ranch Hand

Joined: Jun 16, 2007
Posts: 686

I have a Date data type in form and when I try to input this
dateChanged is of data type Date which resides in input.processParameters.dateChanged. How do I fix this? I read something about initBinder but not sure.

Spring throws the following error:



If I use the following intiBinder:


I get the following error:


===Vyas Sanzgiri===
My Blog
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
What are the versions of JRE and Spring you're using?


SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
Vyas Sanzgiri
Ranch Hand

Joined: Jun 16, 2007
Posts: 686

JRE 1.5

Spring 2.5.6

How does that matter??
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
Vyas Sanzgiri wrote:JRE 1.5

Spring 2.5.6

How does that matter??

It *could* matter, because they are software they have bugs. You're using Sun JRE or OpenJDK JRE?

Anyway, from the error log why there are 2 dates: 2009-09-21 and 2009-08-20?
And please post your command class code.
Vyas Sanzgiri
Ranch Hand

Joined: Jun 16, 2007
Posts: 686

Sun JRE.

There are 2 dates cause processParameters is a ArrayList inside Input class and processParameters contains a dateChanged field
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
Please post the command class source code.
Vyas Sanzgiri
Ranch Hand

Joined: Jun 16, 2007
Posts: 686

If you mean the form here is the code:



Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
Change this:


To this:
Vyas Sanzgiri
Ranch Hand

Joined: Jun 16, 2007
Posts: 686

Does not work same error :

Field [2009-08-20] isn't an enum value java.lang.NoSuchFieldException: 2009-08-20
 
jQuery in Action, 2nd edition
 
subject: IllegalArgumentException: Cannot convert value of type [java.lang.String] to required
 
Similar Threads
java.net.SocketException: Broken pipe
Where are my sessions stored?
Request processing failed; nested exception is org.springframework.beans.InvalidPropertyException:
Hibernate System Exception
Problem with Updating Foreign key values