Question

I am trying to configure my project to run JPA2.1 with Hibernate Validator 5.1.2 on Weblogic 12.1.3, but I'm running into issues when I try to deploy my project.

I configured weblogic to use JPA2.1 using the manual method as described on the tthis Documentation Page for Weblogic 12.1.3: http://docs.oracle.com/middleware/1213/wls/EJBAD/using_toplink.htm#EJBAD1508

I want to use hibernate-validator 5.1.2 in my project, which I configured this as such:

Maven dependency:

<dependency>
 <groupId>org.hibernate</groupId>
 <artifactId>hibernate-validator</artifactId>
 <version>5.1.2.Final</version>
</dependency>

weblogic.xml

<container-descriptor>
    <prefer-application-packages>
        <!-- hibernate validator 5.1.2 over HV 4.1 -->
        <package-name>javax.validation.*</package-name>
        <package-name>org.hibernate.validator.*</package-name>
        <!-- guava 13 -->
        <package-name>com.google.common.collect.*</package-name>
    </prefer-application-packages>
    <prefer-application-resources>
        <!-- hibernate validator 5.1.2 over HV 4.1 -->
        <resource-name>META-INF/validation-mapping-1.1.xsd</resource-name>
        <resource-name>META-INF/validation-configuration-1.1.xsd</resource-name>
    </prefer-application-resources>
</container-descriptor>

On deployment i get the following exception:

<Aug 1, 2014 10:46:16 AM CEST> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID "8725280002070" for task "0". Error is: "weblogic.application.ModuleException: java.lang.ClassNotFoundException: org.hibernate.validator.HibernateValidator"
weblogic.application.ModuleException: java.lang.ClassNotFoundException: org.hibernate.validator.HibernateValidator
    at weblogic.application.internal.ExtensibleModuleWrapper.prepare(ExtensibleModuleWrapper.java:114)
    at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:100)
    at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:175)
    at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:170)
    at weblogic.application.utils.StateMachineDriver$ParallelChange.run(StateMachineDriver.java:80)
    Truncated. see log file for complete stacktrace
Caused By: java.lang.ClassNotFoundException: org.hibernate.validator.HibernateValidator
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:357)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:318)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:186)
    Truncated. see log file for complete stacktrace
> 

I did not get this exception when I had my project configured on Weblogic 12.1.2 with JPA2.0 and Hibernate Validator 4.3.1.

Does anyone have suggestions on how to fix this?

Was it helpful?

Solution

Oracle released "Interim Patch for Bug: 20087183" last week that fixes this issue.

OTHER TIPS

Since you activated JPA 2.1, it means that classes of JPA are loaded at the highest classloader. Hibernate Validator is "used" by JPA classes, thus requiring Hibernate classes to be available at the same, or higher classloader than JPA classes.

Try to load the Hibernate JARs along with the JPA 2.1 JARs on your startup script. I am not sure if this will work but this is definitely a classloader ordering problem.

If you are not sure in which classloader to load the Hibernate classes, use WebLogic CAT (Classloader Analysis Tool) to see where it should go.

Hope it helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top