Hibernate :java.lang.NoSuchMethodError:javax/validation/spi/ConfigurationState.getParameterNameProvider()Ljavax/validation/ParameterNameProvider
Asked Answered
C

2

9

We are executing Junit suite for Spring-Hibernate based application( using spring text conext Unit testing framework).and using ANT for building and below Hibernate Jars are there in build path .

hibernate-validator-5.0.1.Final.jar
validation-api-1.1.0.Final.jar

hibernate-commons-annotations-4.0.2.Final.jar
hibernate-core-4.2.3.Final.jar
hibernate-ehcache-4.2.3.Final.jar
hibernate-entitymanager-4.2.3.Final.jar

We are getting below error seems related to Hibernate validation.

   java.lang.NoSuchMethodError:javax/validation/spi/ConfigurationState.getParameterNameProvider()Ljavax/validation/ParameterNameProvider at org.hibernate.validator.internal.engine.ValidatorFactoryImpl.(ValidatorFactoryImpl.java:113) at org.hibernate.validator.HibernateValidator.buildValidatorFactory(HibernateValidator.java:45) at org.hibernate.validator.internal.engine.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:217) at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:50) at org.hibernate.cfg.beanvalidation.TypeSafeActivator.getValidatorFactory(TypeSafeActivator.java:445) at org.hibernate.cfg.beanvalidation.TypeSafeActivator.activate(TypeSafeActivator.java:96) at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.integrate(BeanValidationIntegrator.java:150)
Chiu answered 19/9, 2013 at 17:20 Comment(0)
G
5

Most likely you have an older version of validation-api on somewhere your classpath (in this case, 1.0.0). Very similar to this question.

Gradin answered 27/3, 2014 at 18:13 Comment(0)
U
0

I ran in to this problem and I think it was becuase I was using Spring Boot and a little older version of Hibernate? I added
compile group: 'org.hibernate', name: 'hibernate-validator', version: '4.3.2.Final'as a dependency and it now works.

Here's my relevant dependencies.

// database
compile 'org.hibernate:hibernate-core:4.3.8.Final'
compile group: 'org.hibernate', name: 'hibernate-hikaricp', version: '4.3.8.Final'
compile group: 'hikari-cp', name: 'hikari-cp', version: '1.7.5'

// without this, hibernate util fails in unit test environment -- something with javax.validator / reading
// properties files
compile group: 'org.hibernate', name: 'hibernate-validator', version: '4.3.2.Final'

compile group: 'postgresql', name: 'postgresql', version: '9.3-1102.jdbc41'
compile group: 'org.hsqldb', name: 'hsqldb', version: '2.3.4'


// spring
compile ('org.springframework.boot:spring-boot-starter-web')
// so that we can use a tomcat web container for dev purposes
compile group: 'org.springframework.boot', name: 'spring-boot-starter-tomcat', version: '1.4.3.RELEASE'
compile group: 'org.springframework', name: 'spring-orm', version: '4.3.5.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-log4j2', version: '1.4.3.RELEASE'
Umbrage answered 23/1, 2017 at 17:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.