Using JAXB with JDK1.5 - Fix for ContextFactory not found issue

This article talks about integrating JAXB with JDK 1.5 version.

What is JAXB?

Java Architecture for XML Binding(JAXB) is a fast and convenient way to bind Java Objects and XML. JAXB makes Marshalling and UnMarshalling easy for the developers.

Starting from JDK 6, JAXB is integrated with JDK itself. Below given the versions available in each JDK version:

JDK6 - JAXB 2.0.3
JDK6 u4 - JAXB 2.1.3
JDK6 u14 - JAXB 2.1.10
JDK7 first release - JAXB 2.2.4-1

JAXB with JDK 1.5

To use JAXB with JDK 1.5 include the maven dependency:

javax.xml.bind jaxb-api 2.1 com.sun.xml.bind jaxb-impl 2.1.12

You may get the below exception if the implementation jars are not included:

javax.xml.bind.JAXBException: Provider com.sun.xml.bind.v2.ContextFactory not found - with linked exception: [java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory]

Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to our feed and get articles like this delivered automatically to your feed reader? Like our Facebook Page.

Post a Comment (0)
Previous Post Next Post