5

I have created a MDB in java using JAXB to parse the xml content. This MDB is working from a long time now (about 3 years) on a 10.3.4 weblogic server.

Now I've to migrate it on a weblogic 12.1.3 server, and for a reason I'm not knowing yet, the implemention choose by weblogic isn't the same as I want. But I can't figure out how to set it.

Right now my code init code is this :

private JAXBContext getJAXBContext() throws JAXBException {
    if (v1JaxbContext == null) {
       v1JaxbContext = JAXBContext.newInstance(MyClass.class);
    }
    System.out.println("jaxbContext : "+v1JaxbContext.getClass().getName());
    return v1JaxbContext;
}

MyClass.java is generated by JAXB from an XSD.

On my eclipse the output is com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl

On my weblogic side the ouput is org.eclipse.persistence.jaxb.JAXBContext

RVA
  • 790
  • 3
  • 14
  • 33

2 Answers2

4

As i was using my code through an EAR I had to put these lines :

<wls:prefer-application-resources>
    <resource-name>META-INF/services/javax.xml.bind.JAXBContext</resource-name>
</wls:prefer-application-resources>  

And create the file in the META-INF directory of my EAR services/javax.xml.bind.JAXBContex which contains only, and it works

com.sun.xml.bind.v2.ContextFactory
RVA
  • 790
  • 3
  • 14
  • 33
2

I faced the same issue and worked out similar solution which doesn't require creating a new file:

<prefer-application-resources> <resource-name>javax.xml.bind.*</resource-name> </prefer-application-resources>

Artemis
  • 271
  • 1
  • 2
  • 8