JAXB 2.x inside OC4J


As seen in previous post a combination of XSL-transformation and data binding isolated in a mapping layer gives decoupling of message producer and message consumer.
The pom.xml dependencies are seen below, using Apache Xalan for XSLT and Sun’s JAXB implementation.



When deploying a mapping layer implementation using JAXB 2.x inside OC4J 10.1.3.x the error might be:
javax.xml.bind.JAXBException: Unable to locate jaxb.properties for package {0}
The reason for this is that the OC4J container comes with JAXB 1.0 runtime support. This is found in the shared
library named oracle.xml, and the javax.xml.bind.JAXBContext will be loaded from ORACLE_HOME/lib/xml.jar.
To get around this a separate shared library need to be defined, containing the jaxb-2.x libraries.

Shared library

Open the Application Server Control (ASC), and navigate to the oc4j-instance->Administration. Create a new shared library and give it a name and a version. Then pick the libraries you need. Note that there are some transitive dependencies for the jaxb-impl-2.2.jar from Sun. You need both activation-1.1.jar, jaxb-api-2.2.jar and stax-api-1.0-2.jar.

The next thing is to make sure your application actually loads and uses this shared library. To do this, edit orion-application.xml to import the shared library.



  • Trackback are closed
  • Comments (1)
    • Cristina Tilivea
    • July 18th, 2010

    Thanks so much, it helped me a lot.

Comment are closed.