更新到Spring 3.2.1后,GenericConversionService.convert()抛出IllegalArgumentException

时间:2013-01-25 12:56:42

标签: spring

将Spring从3.2.0.RELEASE更新为3.2.1.RELEASE后出现以下错误:

[skip]
java.lang.IllegalArgumentException: The source to convert from must be an instance of @org.hibernate.validator.constraints.NotEmpty @javax.validation.constraints.Size @javax.validation.constraints.Pattern java.lang.String; instead it was a ru.mystamps.web.model.ActivateAccountForm
    at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:164)
    at org.springframework.validation.AbstractPropertyBindingResult.formatFieldValue(AbstractPropertyBindingResult.java:125)
    at org.springframework.validation.AbstractBindingResult.getFieldValue(AbstractBindingResult.java:222)
    at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:120)
    at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:179)
    at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:199)
    at org.springframework.web.servlet.tags.form.LabelTag.autogenerateFor(LabelTag.java:130)
    at org.springframework.web.servlet.tags.form.LabelTag.resolveFor(LabelTag.java:120)
    at org.springframework.web.servlet.tags.form.LabelTag.writeTagContent(LabelTag.java:90)
    at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:103)
    at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:80)
    at org.apache.jsp.WEB_002dINF.tiles.body.account.activate_jsp._jspx_meth_form_label_2(activate_jsp.java:667)
    at org.apache.jsp.WEB_002dINF.tiles.body.account.activate_jsp._jspService(activate_jsp.java:224)
[skip]

模型声明:

@FieldsMismatch(first = "login", second = "password")
public class ActivateAccountForm implements ActivateAccountDto {                                    
     @Size(max = ValidationRules.LOGIN_MAX_LENGTH)
    private String login;

    ...
}

控制器:

@RequestMapping(value = Url.ACTIVATE_ACCOUNT_PAGE, method = RequestMethod.POST)                 
public String processActivationForm(@Valid ActivateAccountForm form, BindingResult result) {
    ...
}

在这种情况下我做错了什么?

1 个答案:

答案 0 :(得分:1)

这听起来像是一个潜在的错误,但我无法复制它。您能否提供有关https://jira.springsource.org/browse/SPR-10243

的更多信息