Testing Java thin client against a Websphere Application Server

This topic discuss how you can test a stand-alone Java™ thin client application using the IBM® Rational® Software Delivery platform. A Java thin client is an application where most of the processing is done on the server-side.

Before you begin

About this task

If you want to run your Java thin client on a production WebSphere Application Server, disregard the procedure in this topic and use the Thin application client available from the WebSphere Application Server installation. For more details, see Running Thin application client code topic available from the WebSphere Application Server Information Center.

Here are the steps to test a Java thin client application using the tools of the workbench:

Procedure

  1. Target your Java project to the WebSphere Application Server Java Runtime Environment (JRE) and libraries.
    1. In the Java perspective, right-click your Java project and select Properties. The Properties dialog box opens for your Java project.
    2. In the left pane, select Java Build Path.
    3. On the right pane, select the Libraries page.
    4. Under the JARS and class folders on the build path list, select the JRE System Library and click the Edit button. The Edit Library dialog box opens.
    5. Under the System library section, select the Alternate JRE radio button and use the Alternate JRE control to select a JRE corresponding to the version-level of the WebSphere Application Server you want to test your Java thin application against. Click Finish.
    6. In the Java Build Path page, click the Add Library button. The Add Library dialog box opens.
    7. Select Server Runtime and click the Next button.
    8. Under the Select a runtime to add to the classpath list, select the version-level of WebSphere Application Server that corresponds to your newly added JRE. Click Finish.
    The following is a screen capture example of the Java Build Path dialog after adding the WebSphere Application Server v7.0 JRE and library:
    This is a screen capture of the Java Build Path dialog after adding the WebSphere Application Server v7.0 JRE and library.
  2. Create a new Java Application run configuration.
    1. In the toolbar of the Java perspective, select Run > Run Configurations. The Run Configurations dialog box opens.
    2. In the left pane, select Java Application and click the New launch configuration (This is an icon of the new launch configuration button) button.
    3. On the right pane there is a Name field, specify a label for your newly created Java Application run configuration.
    4. In the Main page, specify the name of the project containing the class to launch in the Project field and the fully qualified name of the main class in the Main class field.
    5. Click the Apply button.
      Tip: If a JRE not compatible with project .class file compatibility: <V.V> error message displays in the Run Configurations dialog box, you can resolve this error by going to the Java perspective, right-click your Java project, and select Properties > Java Compiler. The <V.V> represents the version-level of the Java developer kit (JDK) compliance level. In the right pane of the Java Compiler page, enable the Enable project specific settings check box and use the Compiler compliance level controls to adjust the levels. The level to adjust the compiler compliance level depends on which version-level of WebSphere Application Server you are testing your Java thin application against:
      Table 1. Selecting a compiler compliance level depends on the version-level of the WebSphere Application Server
      Version-level of the WebSphere Application Server Compiler compliance level
      V8.0 1.6 or lower
      V7.0 1.6 or lower
      V6.1 1.5 or lower
      V6.0 1.4 or lower
  3. Copy the VM arguments from a WebSphere Application Server Application Client run configuration into your newly created Java Application run configuration.
    1. In the left pane, select WebSphere Application Server v<X> Application Client and click the New launch configuration (This is an icon of the new launch configuration button) button. Where <X> depends on which version-level of the application server you want to test your Java thin application against.
    2. On the right pane, select the Arguments pane. Copy the values in the VM arguments field by right-clicking in the VM arguments field and select Select All. Then right-click and select Copy.
    3. Optional: You can delete the newly created WebSphere Application Server Application Client run configuration.
    4. In the left pane, under the Java Application node select your Java Application run configuration.
    5. On the right pane, select the Arguments pane. Paste the values in the VM arguments field by right-clicking in the VM arguments field and select Paste.
    6. Click the Apply button.
  4. By default the Run configuration tool provides a copy of the JRE and .jar files referenced in the Java project for compiling.
  5. In the Classpath page of the Run configuration dialog box, add the classpath to the WebSphere Application Server JAR files and directories required at run time by the Java thin client application. The correct set of JAR files to add can vary depending on the nature of your application. For testing purpose, you can add all the JAR files under the following specified directories; and then later sort the JAR files that are needed to run your application. Depending on which version-level of WebSphere Application Server you are running your Java thin client application against, you can find the JAR files and directories at the following locations:

    <installation_directory> is the installation directory of the IBM Rational Software Delivery Platform. For example, on the Windows operating system, the default installation directory is C:\Program Files\IBM\SDP, and on Linux is /opt/IBM/SDP

    <profileName> is the name of the WebSphere Application Server profile. For example, the installation procedure for IBM Rational Software Delivery Platform V8.0 creates a WebSphere Application Server v7.0 profile which is assigned a default role with the following naming convention: was70profile1

    Option Description
    WebSphere Application Server V8.0

    The stand-alone thin clients are provided as embeddable JAR files in the %WAS_HOME%/runtimes directory of WebSphere Application Server. The default install location is Rational_install_dir\SDP\runtimes\base_v8\runtimes.

    The com.ibm.ws.ejb.thinclient_8.0.0.jar is a lightweight client that can be used for such things as JNDI lookup. Depending on the type of client you could also use EJB, JPA, JMS or Web Service specific JAR as appropriate. Sometimes it is necessary to use com.ibm.ws.orb_8.0.0.jar for Namespace issues.

    For more information on technology-specific thin clients, refer to the following web resources:

    Import the appropriate JAR file by right-clicking your project and selecting Properties > Java Build Path > Libraries > Add External JARs.

    Only if these thin client runtime JAR files are insufficient, import the JAR files under the following directories:
    • <installation_directory>\runtimes\base_v8\lib
    • <installation_directory\runtimes\base_v8\plugins
    • <installation_directory>\runtimes\base_v8\profiles\<profileName>\installedConnectors\wmq.jmsra.rar
    WebSphere Application Server V7.0

    The stand-alone thin clients are provided as embeddable JAR files in the %WAS_HOME%/runtimes directory of WebSphere Application Server. The default install location is Rational_install_dir\SDP\runtimes\base_v7\runtimes.

    The com.ibm.ws.ejb.thinclient_7.0.0.jar is a lightweight client that can be used for such things as JNDI lookup. Depending on the type of client you could also use EJB, JPA, JMS or Web Service specific JAR as appropriate. Sometimes it is necessary to use com.ibm.ws.orb_7.0.0.jar for Namespace issues.

    For more information on technology-specific thin clients, refer to the following web resources:

    Import the appropriate JAR file by right-clicking your project and selecting Properties > Java Build Path > Libraries > Add External JARs.

    Only if these thin client runtime JAR files are insufficient, import the JAR files under the following directories:
    • <installation_directory>\runtimes\base_v7\lib
    • <installation_directory\runtimes\base_v7\plugins
    • <installation_directory>\runtimes\base_v7\profiles\<profileName>\installedConnectors\wmq.jmsra.rar
    Depending on the nature of your application you may also need to add some property files by adding the following directory: <installation_directory>\runtimes\base_v7\profiles\<profileName>\properties
    WebSphere Application Server V6.1

    In the Rational_install_dir\SDP\runtimes\base_v61\runtimes folder there are thin clients for Web services, as well as com.ibm.ws.admin.client.jar - a lightweight client that can be used for such things as JNDI lookup.

    Only if these thin client runtime JAR files are insufficient, import the JAR files under the following directories:
    • <installation_directory>\runtimes\base_v61\lib
    • <installation_directory>\runtimes\base_v61\lib\WMQ\java\lib
    • <installation_directory\runtimes\base_v61\plugins
    Depending on the nature of your application you may also need to add some property files by adding the following directory: <installation_directory>\runtimes\base_v61\profiles\<profileName>\properties
    WebSphere Application Server V6.0 Import the JAR files under the following directories:
    • <installation_directory>\runtimes\base_v6\lib
    • <installation_directory>\runtimes\base_v6\lib\WMQ\java\lib
    Depending on the nature of you application you may also need to add some property files by adding the following directory: <installation_directory>\runtimes\base_v6\profiles\<profileName>\properties
    1. To add JAR files, under the Classpath list select User Entries and click the Add External JARs button. The Jar Selection dialog box opens.
      Tip: You can select multiple JAR files in the Jar Selection dialog box by holding the Shift key and selecting the multiple JAR files.
    2. In the Jar selection dialog box, click Open.
    3. To add directories, under the Classpath list select User Entries and click the Advanced button. Select the Add External Folder radio button. Click OK. The Folder Selection dialog box opens. Navigate to the directory you want to add and select OK.
  6. You can run the Java thin client by selecting the Run button from the Run Configurations dialog box.

Results

The system output of running your Java thin client shows in the Console view.

Feedback