Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Method-level validation in Spring 3.2.3 with Hibernate Validator 5.0.0.final

I have enabled method level validation in service class. However I got java.lang.NoClassDefFoundError during startup of the application. Anyone know the workaround solution for this issue:

Caused by: java.lang.NoClassDefFoundError: org/hibernate/validator/method/MethodConstraintViolationException
    at org.springframework.validation.beanvalidation.MethodValidationPostProcessor.afterPropertiesSet(MethodValidationPostProcessor.java:102)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
    ... 55 more
like image 796
kenn3th Avatar asked Feb 15 '23 22:02

kenn3th


1 Answers

Hibernate 5 custom integration will be supported only with the upcoming Spring 4 (https://jira.springsource.org/browse/SPR-10466).

If you really want to use Hibernate 5, you will need to use it as standard JSR 303 bean validation provider with the standard message interpolation mechanism (i.e. no integration with MessageSource, but standard ValidationMessages.properties).

like image 191
Pavel Horal Avatar answered Apr 07 '23 12:04

Pavel Horal