从 Weblogic 11c 切换到 Weblogic 12c 后,我遇到了这个异常:
javax.persistence.PersistenceException: [PersistenceUnit: JpaPersistenceUnit] Unable to build EntityManagerFactory
...
Caused By: java.lang.NoSuchMethodError: javax.validation.spi.ConfigurationState.getParameterNameProvider()Ljavax/validation/ParameterNameProvider;
at org.hibernate.validator.internal.engine.ValidatorFactoryImpl.<init>(ValidatorFactoryImpl.java:113)
at org.hibernate.validator.HibernateValidator.buildValidatorFactory(HibernateValidator.java:45)
我发现了有关这些主题的其他问题,但所有解决方案都是关于错误的库(Vaadin 7 - Bean Validation)。我认为我的休眠验证器与 bean 验证器库匹配。这就是我在 WEB-INF/lib 中的内容:
hibernate-c3p0-4.2.4.Final.jar
hibernate-commons-annotations-4.0.2.Final.jar
hibernate-core-4.2.4.Final.jar
hibernate-entitymanager-4.2.4.Final.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
hibernate-validator-5.0.1.Final.jar
validation-api-1.1.0.Final.jar
它可能是由其他一些依赖引起的吗?
编辑 我目前在我的 weblogic-application.xml 中有这个,一切正常:
<weblogic-application>
<prefer-application-packages>
<package-name>javax.wsdl.*</package-name>
<package-name>javax.faces.*</package-name>
<package-name>org.apache.taglibs.*</package-name>
<package-name>org.springframework.*</package-name>
<package-name>javax.persistence.*</package-name>
<package-name>org.hibernate.*</package-name>
<package-name>javax.validation.*</package-name>
<package-name>javax.validation.bootstrap.*</package-name>
<package-name>javax.validation.constraints.*</package-name>
<package-name>javax.validation.groups.*</package-name>
<package-name>javax.validation.metadata.*</package-name>
<package-name>javax.validation.spi.*</package-name>
<package-name>org.slf4j.*</package-name>
</prefer-application-packages>
<prefer-application-resources>
<resource-name>javax.faces.*</resource-name>
<resource-name>org.apache.taglibs.*</resource-name>
<resource-name>org.springframework.*</resource-name>
<resource-name>javax.persistence.*</resource-name>
<resource-name>javax.validation.*</resource-name>
<resource-name>org.hibernate.*</resource-name>
</prefer-application-resources>
</weblogic-application>