Today I will be talking about how to make your thin client application easily distributable to systems that do not have a WebSphere Application Server runtime installed.
Some background first:
Thin clients are standalone java programs typically used to start or invoke an application running on a server. The word 'thin' implies that ideal thin clients are lightweight: they are simple to run and easy to distribute. Despite their lightweight nature, they are also highly functional because the WebSphere client runtime provides a set of features that one can use in a thin client (see footnote 1). To facilitate such a simple but functional environment, WebSphere Application Server provides the setupCmdLine.sh script that automatically sets up the client runtime (see footnote 2).
Unfortunately the setupCmdLine.sh script and the various .jar files that it references are unavailable on machines that do not have a WebSphere runtime installed. Until WebSphere Application Server V7, this condition posed a challenge in maintaining the 'easy to distribute' nature of a thin client. More specifically, setting up the client runtime on a machine with no WebSphere runtime installed was difficult as it required copying various .jar and properties files, and writing a custom script to put them on the classpath. Doing this also causes the thin client to lose its 'simple to execute' nature.
Good news in V7:
WebSphere Application Server V7 introduces exactly one WebSphere .jar file that needs to be referenced to run a thin client (see footnote 3): com.ibm.ws.ejb.thinclient.zos_7.0.0.jar or com.ibm.ws.ejb.thinclient_7.0.0.jar. This makes thin clients much easier to run and distribute to machines that do not have a WebSphere runtime installed.
This works great for Distributed platforms.
WebSphere Application Server for z/OS exception:
Unfortunately, if you tried to use com.ibm.ws.ejb.thinclient.zos_7.0.0.jar on a WebSphere Application Server for z/OS LPAR that does not have a WebSphere runtime installed, you most likely came across the following error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: bbojutil (Not found in java.library.path)
Or, if you tried to use com.ibm.ws.ejb.thinclient_7.0.0.jar, you came across the following error:
Caused by: java.lang.NoClassDefFoundError: com.ibm.ws390.utility.JAVAtoCPPUtilities
This happens because on WebSphere Application Server for z/OS there is a dependency on native libraries. Most likely, these libraries will not be present in a z/OS LPAR with no WebSphere runtime installed.
There is a reasonable workaround to the above problem on WebSphere Application Server for z/OS. When you are running a thin client on a z/OS LPAR with no WebSphere runtime installed, just use the com.ibm.ws.ejb.thinclient_7.0.0.jar file along with the -D argument: com.ibm.websphere.zos.forcedist=true
-classpath com.ibm.ws.ejb.thinclient_7.0.0.jar:<remaining classpath entries>
This causes the thin client to run a Distributed platform like code path and bypass the z/OS native library dependency. Below is a sample snippet that executes the InteropClient (see footnote 4) on a z/OS LPAR that has no WebSphere runtime installed:
-classpath com.ibm.ws.ejb.thinclient_7.0.0.jar:InteropEJB.jar:InteropClient.jar \
1: Information Center - Table comparing different types of thin and application clients
2: Information Center - Sample thin client scripts
3: Information Center - References for thin client .jar files: z/OS, Distributed.
4: IBM White paper - The Interop.ear sample application that includes a thin client