1

I am facing an issue. Not able to get the solution if any one can help me. I am implementing JAXB in my code for XML validation through XSD and XSLT. Error is a class conflicting between JRE and Weblogic server. Application is not able to understand which to refer.

Java version: 7 Weblogic: 10.3.3 (Weblogic 11g)

Caused by: 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, loader constraint violation: when resolving field "DATETIME" the class loader 
    at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl.<clinit>(RuntimeBuiltinLeafInfoImpl.java:224)
    at com.sun.xml.bind.v2.model.impl.RuntimeTypeInfoSetImpl.<init>(RuntimeTypeInfoSetImpl.java:61)
    at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createTypeInfoSet(RuntimeModelBuilder.java:127)
    at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createTypeInfoSet(RuntimeModelBuilder.java:79)
    at com.sun.xml.bind.v2.model.impl.ModelBuilder.<init>(ModelBuilder.java:151)
    at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.<init>(RuntimeModelBuilder.java:87)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:422)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:286)
    at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)
    at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:117)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:211)
    at javax.xml.bind.ContextFinder.find(ContextFinder.java:372)
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)

Thank you in advance for the help.

AlexZeDim
  • 3,520
  • 2
  • 28
  • 64
Nikky
  • 31
  • 4

1 Answers1

2

Here in the logs error was showing that conflict was in DataTypeConstants. Actually I analysed the conflicts of classes in weblogic. Then I came to know that DataTypeConstants name was not present in the conflicts. My error was coming on the line:

JAXBContext obj = JAXBContext.newInstance(MyClass.class);

On this line NullPointerException was shown. Jaxb-api.jar was present in my library , so JAXBContext was loading from their , inside that DataTypeConstants was getting conflict. I removed my Jaxb-api.jar and then weblogic took my JAXBContext and DataTypeConstants both from rt.jar of JRE. As both the classes were in one jar rt.jar got the preference to load DataTypeConstants.

To know how to analyse conflicts of classes in weblogic, Below are the links which will help. Visit https://dzone.com/articles/weblogic-classloader-analysis and https://blog.eisele.net/2011/01/using-new-weblogic-classloader-analysis.html

Nikky
  • 31
  • 4