BW6 Java activities calling third party library code in Java code.

BW6 Java activities calling third party library code in Java code.

book

Article ID: KB0093584

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks -
Not Applicable -

Description

Description:
If you have a Java class in your application or a Java shared module which calls a method from a third party library, the method invocation works fine in Studio. But when you install the application in Admin, it fails with ClassNotFoundException, with regard to classes present in the third party library.



Issue/Introduction

BW6 Java activities calling third party library code in Java code.

Resolution

For the Java code to lookup the third party classes at runtime, set ContextClassLoader as follows: 

    ClassLoader cl = null;

    cl = Thread.currentThread().getContextClassLoader();
    try
    {
      Thread.currentThread().setContextClassLoader(getClass().getClassLoader());

 .....Your Java Code calling the third party library.....

    } finally {
      Thread.currentThread().setContextClassLoader(cl);
    }

There is a sample shipped with product showing the usecase : Interoperability of Using JAX-WS Client to Invoke Service  (tibco.bw.sample.binding.soap.http.JAXWSInterop).

Additional Information

https://docs.tibco.com/pub/activematrix_businessworks/6.2.2/doc/html/GUID-AAA072A8-A6C2-4372-BBF7-316EAB33D248.html