从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)。我认为我的hibernate-validator与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>
该java.lang.NoSuchMethodError主要是由于在类路径无效库版本。似乎WebLogic 12c使用的验证API与您的应用程序期望的版本不同。为了强制它使用您WEB-INF/lib文件夹中的那个,您必须使用中的prefer-web-inf- classeselement 指定它weblogic.xml。
java.lang.NoSuchMethodError
WEB-INF/lib
prefer-web-inf- classes
weblogic.xml
这里是有关的更多文档prefer- web-inf-classes
prefer- web-inf-classes