我们正在为基于 Spring-Hibernate 的应用程序执行 Junit 套件(使用 spring text conext 单元测试框架)。并使用 ANT 进行构建,Hibernate Jars 位于构建路径中。
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
我们遇到的错误似乎与 Hibernate 验证有关。
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)