Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JDev 12.1.3 - java.lang.ClassCastException: org.eclipse.persistence.jaxb.JAXBContext cannot be cast

Jon OBrien-OracleJul 17 2015 — edited Jul 17 2015

Hi all,

We have an ADF project running fine in JDev 11.1.1.7 and we're attempting to migrate it to JDev 12.1.3. The project contains a client jar which makes WS connections and to facilitate the WS functionality it packages JAXB 2.2 jars within the client package itself.

The problem is that despite the client jar packaging the JAXB 2.2 jars, when the app runs and calls methods from the client jar, we get a "java.lang.ClassCastException: org.eclipse.persistence.jaxb.JAXBContext cannot be cast to com.sun.xml.bind.api.JAXBRIContext" - it shouldn't be trying to use org.eclipse.persistence.jaxb.JAXBContext, it should be trying to use "javax.xml.bind.JAXBContext" (which is packaged in the client jar) which would then allow the cast to JAXBRIContext.

The "org.eclipse.persistence.jaxb.JAXBContext" classes are below the "javax.xml.bind.JAXBContext" in the CLASSPATH so I don't understand why the persistence classes are being used in preference to those packaged in the client jar?

Is there a way of ensuring that the calls made to code in the client jar uses the packaged JAXB 2.2 jars instead of the other project jars?

Thanks in advance

Jon

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 14 2015
Added on Jul 17 2015
2 comments
550 views