Java code inside class file referring to external libraries that are shipped as part of product, is not resolved at standalone runtime (appnode).

Java code inside class file referring to external libraries that are shipped as part of product, is not resolved at standalone runtime (appnode).

book

Article ID: KB0084678

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks -
Not Applicable -

Description

Description:
App Module w/Java Nature has a Java class which uses a class from a 3rd party library named ABCCompany.jar. This ABCCompany.jar internally depends on some frameworks like implementations of "javax.xml.parsers", "org.apache.xerces.jaxp.*" or any other framework implementation which are shipped along with the BW product.

Here is the sequence : Java Class ->instantiates-> 3rd party company library called (ABCCompany.jar) -> depends on ->xerces impl jar

The app module deploys and starts fine in Studio runtime environment.

When you deploy the same application using EAR in an appspace / appnode, it fails to resolve the dependencies on xerces impl jar which are shipped with product.


Issue/Introduction

Java code inside class file referring to external libraries that are shipped as part of product, is not resolved at standalone runtime (appnode).

Resolution

Set the context class loader thread to its own class loader and reset it back to original class loader once your code execution is done.

Java method : 

public void myMethod(){

   cl = Thread.currentThread().getContextClassLoader();
String[] Filenames = null;
try {
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
                        ....
                        .....
}finally{
Thread.currentThread().setContextClassLoader(cl);
}

Additional Information

There is a sample shipped with this use case along with BW 6.x product : Interoperability of Using JAX-WS Client to Invoke Service under SOAP/HTTP Binding samples section.