我们在 Websphere 7&8 和 Jboss EAP6 上测试了当前的 Spring 应用程序
有趣的发现是,这个应用程序在一台 Jboss 服务器上运行良好,但会在另一台 Jboss服务器上抛出异常,两者都是 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"]
从 UI 来看,两个 Jboss 服务器日期字段的格式都为“dd\mm\yyyy”,但它只是在一台服务器上抛出异常,但在另一台服务器上就像魅力一样
我们可以从服务器端配置中克服它吗?