Using JAXB2 with JDeveloper 10g

This post describes how to use JAXB 2 on JDeveloper 10.1.3.3, by using I mean compiling the program and testing it on the embedded OC4J if you want.

The problem is that the embedded OC4J has a default implementation of JAXB 1 which varies big time from JAXB2 as the first version didn’t contain annotations. To use your JAXB2 libraries as a replacement to JAXB1 in OC4j 10 you have to make a shared library and attach it to your application on deployment, for embedded oc4j this process isn’t easy as it doesn’t have an interface to do this so you would have to manually edit some XML files to do this and some of those files may be overridden if the application is deployed automatically  that’s when you click run on a servlet, ejb , …etc. this link (http://buttso.blogspot.com/2007/09/using-jaxb-20-with-oc4j-1013x.html) shows how to add a shared library to your application in embedded oc4j (at the comments section).

JDeveloper comes with it’s own JDK  and the embedded OC4J uses this JDK, according to the application server specification the classes under java.* or javax.* will be looked up in the JDK (or JRE) first, if not found the application server will start looking up in the lib folder of your WEB-INF or in a shared library as OC4J. The JAXB2 implementation classes have the package of javax.* so simply if you want your embedded OC4J to use the JAXB2 implementation instead on JAXB1, put the jars of JAXB2 in the JRE of the JDeveloper you are using, this will be found under the directory:

<YOUR_PATH>\jdevstudio10133\jdk\jre\lib\ext

This solution is better in my opinion than adding a shared library to your embedded oc4j because why would I care to keep the implementation of JAXB1 – by adding a shared library I’m just overriding this implementation for this application – if I’m sure that I won’t be using it any more and If I have a new application that needs JAXB2 I would have to repeat the same steps for it.

Feel free to drop in a comment or e-mail me for any questions/ feedback.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s