Friday, March 21, 2014

Weblogic 11g deployment error , loader constraint violation: when resolving field "DATETIME"

Error :

 INFO com.sun.jersey.server.impl.application.WebApplicationImpl Initiating Jersey application, version 'Jersey: 1.8 06/24/2011 12:17 PM'
<Mar 20, 2014 3:08:39 PM CDT> <Error> <HTTP> <BEA-101216> <Servlet: "jersey-serlvet" failed to preload on startup in Web application: "sampleapp".
java.lang.LinkageError: loader constraint violation: when resolving field "DATETIME" the class loader (instance of weblogic/utils/classloaders/ChangeAwareClassLoader) of the referring class, javax/xml/datatype/DatatypeConstants, and the class loader (instance of <bootloader>) for the field's resolved type, javax/xml/namespace/QName, have different Class objects for that type


Solution:

The error occurred due to a conflicts between the class provided by the weblogic and the jaxb-impl.jar packaged within ear file.

I added the jax-impl dependency in pom as 'provided' scope so that its excluded from packaging. The container provided classes are used then.

<dependency>
                <groupId>com.sun.xml.bind</groupId>
                  <artifactId>jaxb-impl</artifactId>
                  <version>2.3.1</version>
                  <scope>provided</scope>               
</dependency>   

No comments:

Post a Comment