Application using JAXB API would work in studio but fail with ClassCastException when deployed to an appnode

Application using JAXB API would work in studio but fail with ClassCastException when deployed to an appnode

book

Article ID: KB0083562

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks 6.3.x

Description


Application using JAXB API would work fine in studio design time but fail with the below exception when deployed to an appnode in runtime
==================
orchestrate javax.xml.bind.JAXBException: ClassCastException: attempting to cast bundleresource://244.fwk1583722422/javax/xml/bind/JAXBContext.class to jar:file:/D:/tibco/tibcojre64/1.8.0/lib/rt.jar!/javax/xml/bind/JAXBContext.class.  Please make sure that you are specifying the proper ClassLoader.
==================

Issue/Introduction

Application using JAXB API would work in studio but fail with ClassCastException when deployed to an appnode

Environment

O/S: All Database:All

Resolution

Use the following line in your custom java code using JAXB API
 
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());