离开空日期输入时JAVA BeanUtils.populate错误

时间:2014-05-12 12:07:06

标签: java date jboss struts-1

今天我已将我的应用程序从JBOSS 4.2迁移到JBOSS 7.1。服务器已成功启动,没有任何错误消息。但是,当我尝试提交任何表格,其中有"日期来自"和"约会到"我收到了这个错误:

javax.servlet.ServletException: BeanUtils.populate
    org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)
    org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:805)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
    org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    org.virc.spack.spring.UTF8Filter.doFilter(UTF8Filter.java:21)
    org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:174)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    org.virc.spack.spring.SpringAccessFilter.doFilter(SpringAccessFilter.java:43)
JBWEB000071: root cause

org.apache.commons.beanutils.ConversionException: No value specified for 'java.sql.Date'
    org.apache.commons.beanutils.converters.AbstractConverter.handleMissing(AbstractConverter.java:327)
    org.apache.commons.beanutils.converters.DateTimeConverter.convertToType(DateTimeConverter.java:327)
    org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:169)
    org.apache.commons.beanutils.converters.ConverterFacade.convert(ConverterFacade.java:61)
    org.apache.commons.beanutils.ConvertUtilsBean.convert(ConvertUtilsBean.java:491)
    org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1002)
    org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:821)
    org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:431)
    org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493)
    org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:805)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
    org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    org.virc.spack.spring.UTF8Filter.doFilter(UTF8Filter.java:21)
    org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:174)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    org.virc.spack.spring.SpringAccessFilter.doFilter(SpringAccessFilter.java:43)

有趣的是,如果我输入" 日期来自"和" 约会"字段,例如(2014-05-01和2014-05-05)并提交表单,我不会收到任何错误。但是,如果我将其中一个字段留空(例如,我将#34; 日期的空字段留给")我得到错误。

在Jboss 4.2版本中,JAVA 1.5 JDK一切运行良好,但在迁移到Jboss 7.1和Java 1.7 JDK后,我遇到了这些错误。有谁知道任何解决方案?

告诉我您是否需要有关使用哪种类型的库等的更多信息。

1 个答案:

答案 0 :(得分:0)

新版本的BeanUtils-1.9修复了这个问题  https://issues.apache.org/jira/browse/BEANUTILS-454