This is an issue of using the hibernate bean validator with weblogic 12. It may be more of a weblogic issue, but posting here in hopes that someone may have some ideas.
I have a dependency in my maven pom for hibernate-validator 6.0.13. I’m making use of HibernateValidatorConfiguration.constraintValidatorPayload (introduced in 6.0.8) to pass context to custom validators.
This works fine in my jUnit tests. However, when I actually run the application in weblogic 12.2.1, I see this exception:
java.lang.NoSuchMethodError: org.hibernate.validator.HibernateValidatorConfiguration.constraintValidatorPayload(Ljava/lang/Object;)Lorg/hibernate/validator/HibernateValidatorConfiguration;
I’ve found that weblogic has hibernate-validator built-in. Under wlserver/modules I see hibernate.validator.jar.
Doing a bit of debugging I’ve found this information for the hibernate validator package when running the application within weblogic:
- Package name: org.hibernate.validator.internal.engine
- Specification = Bean Validation
- Spec Version = 1.1
- Spec Vendor = null
- Implementation = hibernate-validator
- Impl Version = 5.1.3.Final
- Impl Vendor = Oracle, Inc.
Whereas when running jUnit tests I have this version of hibernate validator
- Package name: org.hibernate.validator.internal.engine
- Specification = Bean Validation
- Spec Version = 2.0
- Spec Vendor = null
- Implementation = hibernate-validator
- Impl Version = 6.0.13.Final
- Impl Vendor = org.hibernate.validator
Any thoughts on how to get access to the desired version of hibernate validator?