Dreamer
Dreamer

Reputation: 7551

Failed to convert from type java.lang.String to type java.util.Date on one JBoss but fine on the other

We have current Spring application tested on Websphere 7&8, and Jboss EAP6

Interesting finding is, this application works totally fine on one Jboss server, but will throw exception on the other one Jboss server, both are eap 6

org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors Field error in object 'masterOrderForm' on field 'orderDate': rejected value [Mon May 27 12:27:20 ART 2013]; codes [typeMismatch.masterOrderForm.orderDate,typeMismatch.orderDate,typeMismatch.java.util.Date,typeMismatch]; 
arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [masterOrderForm.orderDate,orderDate]; arguments []; default message [orderDate]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'java.util.Date' for property 'orderDate'; 
nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type java.lang.String to type java.util.Date for value 'Mon May 27 12:27:20 ART 2013'; nested exception is java.lang.IllegalArgumentException: Invalid format: "Mon May 27 12:27:20 ART 2013"]
org.springframework.validation.BeanPropertyBindingResult: 1 errors Field error in object 'masterOrderForm' on field 'orderDate': rejected value [Mon May 27 12:27:20 ART 2013]; codes [typeMismatch.masterOrderForm.orderDate,typeMismatch.orderDate,typeMismatch.java.util.Date,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [masterOrderForm.orderDate,orderDate]; arguments []; default message [orderDate]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'java.util.Date' for property 'orderDate'; 
nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type java.lang.String to type java.util.Date for value 'Mon May 27 12:27:20 ART 2013'; nested exception is java.lang.IllegalArgumentException: Invalid format: "Mon May 27 12:27:20 ART 2013"]

From the UI both Jboss server date field has format as "dd\mm\yyyy", but it just throw exception on one server but works like charm on the other

Is it something we can over come from server side configuration?

Upvotes: 1

Views: 6566

Answers (1)

Badaro
Badaro

Reputation: 576

I Googled the error and found this link.

If it's all ok on code, maybe the JVMs are running with diferent locale configuration.

Upvotes: 1

Related Questions