Program guide > Plan to develop applications



Run a WebSphere eXtreme Scale client or server application with Apache Tomcat in Rational Application Developer

Whether you have a client or server application, use the same basic steps to run the application in Apache Tomcat in Rational Application Developer. For a client application, to configure and run a web application to use a WebSphere eXtreme Scale client in Rational Application Developer. Follow these instructions to create a web project for running a WebSphere eXtreme Scale catalog service or container. For a server application, to enable a Java™ EE application in Rational Application Developer interface with a stand-alone installation of WebSphere eXtreme Scale. Follow these instructions to configure a Java EE application project for using the WebSphere eXtreme Scale client library.


Before you begin

Install the WebSphere eXtreme Scale Trial or full product.


Procedure

  1. Add WebSphere eXtreme Scale runtime library to the Java EE build path.

    Client application In this scenario, you want to configure and run a web application to use a WebSphere eXtreme Scale client in Rational Application Developer.

    1. Window > Preferences > Java > Build Path > User Libraries. Click New.

    2. Enter a User library name of eXtremeScaleClient, and click OK.

    3. Click Add Jars..., and navigate to and select the wxs_home/lib/ogclient.jar file. Click Open.

    4. Optional: (Optional) To add Javadoc, select Javadoc location and click Edit.... In the Javadoc location path, you can either enter the URL of the API documentation, or you can download the API documentation.

      • To use the online API documentation, enter http://www.ibm.com/developerworks/wikis/extremescale/docs/api/ in the Javadoc location path.

      • To download the API documentation, go to the WebSphere eXtreme Scale API documentation download page. For the Javadoc location path, enter the local download location.

    5. Click OK.

    6. Click OK to close out the User Libraries dialogue.

    7. Click Project > Properties.

    8. Click Java Build Path.

    9. Click Add Library.

    10. Select User Library. Click Next.

    11. Check the eXtremeScaleClient library and click Finish.

    12. Click OK to close the Project Properties dialog.

    Server application In this scenario, to configure and run a web application to run an embedded WebSphere eXtreme Scale server in Rational Application Developer.

    1. Click Window > Preferences > Java > Build Path > User Libraries. Click New.

    2. Enter a User library name of eXtremeScale, and click OK.

    3. Click Add Jars..., and select wxs_home/lib/objectgrid.jar. Click Open.

    4. (Optional) To add Javadoc, select Javadoc location and click Edit.... In the Javadoc location path, Enter http://www.ibm.com/developerworks/wikis/extremescale/docs/api/.

    5. Click OK.

    6. Click OK to close out the User Libraries dialogue.

    7. Click Project > Properties.

    8. Click Java Build Path.

    9. Click Add Library.

    10. Select User Library. Click Next.

    11. Check the eXtremeScaleClient library and click Finish.

    12. Click OK to close the Project Properties dialog.

  2. Define Tomcat Server for our project.

    1. Ensure that you are in the J2EE perspective and click the Servers tab in the bottom pane. You can also click Window > Show View > Servers.

    2. Right-click in the Servers pane, and choose New > Server.

    3. Choose Apache, Tomcat v6.0 Server. Click Next.

    4. Click Browse... Select tomcat_root. Click OK.

    5. Click Next.

    6. Select the Java EE application in the left Available pane and click Add > to move it to the right Configured pane on the server, and click Finish.

  3. Resolve any remaining errors for the Project. Use the following steps to eliminate errors in the Problems pane:

    1. Click Project > Clean > project_name. Click OK. Build the project.

    2. Right-click on the Java EE project, and choose Build Path > Configure Build Path.

    3. Click the Libraries tab. Verify the path is configured properly:

      • For client applications: Ensure that Apache Tomcat, eXtremeScaleClient, and Java 1.5 JRE are on the path.

      • For server applications: Ensure that Apache Tomcat, eXtremeScale, and Java 1.5 JRE are on the path.

  4. Create a run configuration to run the application.

    1. From the Run menu, select Run Configurations.

    2. Right-click the Java Application category and select New.

    3. Select the new run configuration, named New_Configuration.

    4. Configure the profile.

      •  Project (on main tabbed page): your_project_name

      • Main Class (on main tabbed page): your_main_class

      • VM arguments (on arguments tabbed page): -Djava.endorsed.dirs=wxs_root/lib/endorsed

      Problems with the VM Arguments often occur because the path to java.endorsed.dirs must be an absolute path with no variables or shortcuts.

      Other common setup problems involve the Object Request Broker (ORB). You might see the following error. See Configure a custom Object Request Broker for more information:

      Caused by: java.lang.RuntimeException: The ORB that comes with the Sun
      Java implementation does not work with ObjectGrid at this time.
      

      If you do not have the objectGrid.xml or deployment.xml files accessible to the application, you might see the following error:

      Exception in thread "P=211046:O=0:CT" com.ibm.websphere.objectgrid.ObjectGridRuntimeException: 
      Cannot start OG container
          at Client.startTestServer(Client.java:161)
          at Client.main(Client.java:82)
      Caused by: java.lang.IllegalArgumentException: The objectGridXML must not be null
          at com.ibm.websphere.objectgrid.deployment.DeploymentPolicyFactory.createDeploymentPolicy
        (DeploymentPolicyFactory.java:55)
          at Client.startTestServer(Client.java:154)
          ... 1 more
      

  5. Click Apply and close the window, or click Run.


What to do next

After you configure and run a web application with WebSphere eXtreme Scale client in Rational Application Developer, you can develop a servlet. This servlet uses the WebSphere eXtreme Scale APIs to store and retrieve data from a remote data grid.

After you enable a Java EE application in Rational Application Developer interface with a stand-alone installation of WebSphere eXtreme Scale, you can develop a servlet that uses the WebSphere eXtreme Scale system APIs to start and stop catalog services.


Parent topic:

Plan to develop applications


Related concepts

WebSphere eXtreme Scale programming interfaces

Class loader and classpath considerations


Related tasks

Set up a stand-alone development environment

Run an integrated client or server application with WAS in Rational Application Developer

Related reference

Directory conventions