当前位置: 代码迷 >> 综合 >> springmvc之JSR303验证出现:警告: Exception encountered during context initialization - cancelling refresh at
  详细解决方案

springmvc之JSR303验证出现:警告: Exception encountered during context initialization - cancelling refresh at

热度:57   发布时间:2023-11-27 02:09:58.0

昨晚在练习springmvc的JSR303数据验证的时候,明明是跟着教程里面走的,可是又出现了一个奇葩的问题:

警告: Exception encountered during context initialization -cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 
'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter':Cannot create inner bean '(inner bean)#296c6593' of type 
[org.springframework.web.bind.support.ConfigurableWebBindingInitializer] while setting beanproperty 'webBindingInitializer'; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 
'(inner bean)#296c6593': Cannot resolve reference to bean 'validator' while setting bean property 'validator'; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 
'validator' defined in class path resource [springmvc.xml]: Invocation of init method 
failed; nested exception is java.lang.NoClassDefFoundError: org/jboss/logging/BasicLogger

 

一下是效果图:

后面还有一大堆出不列出来了,昨晚搞了大半夜,今天搞了大半天都不行,后来一个道友建议我换一下jar包,我也只能死马当活马医了,原来的springmvc的jar是4.3的,JSR303相关的jar包也是比较高版本的,我把所有的jar包换了一个低一点的版本以后,奇迹出现了:

没错,我要验证的就是输入的时间是否是过去的时间。所以,如果你也遇到这样的问题,在其他方法都不奏效以后,也可以试试将你的jar包改为低一些的版本试一试。

  相关解决方案