### Clustering with IBM WebSphere Server 5.1

The following example describes how to configure a WebSphere 5.1 cluster and then integrate JReport Enterprise Server in the cluster.

#### Configuring a WebSphere 5.1 cluster

Assuming that there are four computers named admin-PC, PC1, PC2, and PC3 in the server cluster. The admin-PC is used as a dispatcher. Each clustered computer should have a unique IP address and host name.

Take the following steps:

1. Installation
   1. Install IBM Http Server1.3.28 on admin-PC.
   2. Install IBM WebSphere Network Deployment Server 5.1 on admin-PC. Set Admin Console Port to 9091 and Soap Connector Address to 8889.
   3. Install IBM WebSphere Application Server 5.1 on PC1, PC2, and PC3.
2. Adding PC1, PC2, and PC3 to Deployment Manager
   1. Start Deployment Manager on admin-PC.
   2. On PC1, go to the folder `<WebSphere_Application_server_install_root>/bin`. Then, use the command `addnode.bat admin-pc 8889` to add the node agent to Deployment Manager. Where 8889 is the Soap Connector Address of the Deployment Manager.
   3. After receiving the successful message, perform the same action on PC2, and then on PC3. Never do this on more than one node at a time.

      After that, on each node there is a node agent running.

3. Creating a cluster

   1. Open a web browser and then use the URL `http://admin-pc:9091/admin` to open the Deployment Manager Administrative Console.
   2. In the Administrative Console, go to Servers > Clusters.
   3. Click New to create a new cluster.
   4. Input a cluster name jreport-cluster. Uncheck the Prefer Local option and check the Create Replication Domain for this cluster option. Then click Next.
   5. Input a clone name clone1 and then select PC1 to assign to. Check the Generate Unique Http Ports and Create Replication Entry in this Server options. Select the Default application server template option. You also can assign a value to weight of this clone. Then click Apply.
   6. Repeat the above step to create clone2 and clone3 which are assigned to PC2 and PC3. Then click Next.
   7. Click Finish. Now, you can start the cluster jreport-cluster.
4. Testing the cluster workable
   1. By default, after installing the WebSphere Application server, there is a standalone server instance named server1 created. The server1 uses port 9080 for the HTTP transport. When a clone is created, another unique HTTP port is created. In this demonstration, this port on clone1, clone2, and clone3 are all set to 9081. You need to add this port to the host alias. Follow Environment > Virtual Hosts > default_host > Host Aliases > New to do this.
   2. Deploy the DefaultApplication.ear from `<WebSphere_install_root>/installableApps`. During the deployment, map the application to the cluster jreport-cluster.
   3. When the deployment has finished, start the application. You can then use these URLs to test whether the clones work or not:

      `http://PC1:9081/hello
      http://PC2:9081/hello
      http://PC3:9081/hello`

5. Working with IBM Http Server
   1. In the Administrative Console, use Environment > Update Web Server Plugin to generate the plugin-cfg.xml file. The file will be generated in `<Network_Deployment_install_root>/config/cells`.
   2. Edit the httpd.conf in `<Http_Server_root>/conf` by adding the following lines:

      `LoadModule ibm_app_server_http_module "d:\WebSphere\AppServer/bin/mod_ibm_app_server_http.dll"
      WebSpherePluginConfig "d:\WebSphere\ DeploymentManager\config \cells\plugin-cfg.xml"`

      The plugin file should point to the one generated before.

   3. Start Http Server, then test the working load, using the following URL:

      `http://admin-pc/snoop`

#### Integrating JReport Enterprise Server in the cluster

1. Create a WAR file including the JReport Enterprise Server application. Be sure to add `<load-on-startup>` in the web.xml.

   For information about creating a JReport Enterprise Server WAR file, see Building a WAR/EAR file to include a self-contained JReport Enterprise Server.

2. Deploy the application WAR. Make sure that it is mapped to the cluster. Set context root to `/jreport`.
3. Set JVM parameter –Dreporthome in each clone.
4. Regenerate the plugin-cfg.xml file.
5. Copy the admin, dhtmljsp, images, javascript, jinfonet, and style folders to `<http_server_root>/htdocs/en_US`.
6. Start the JReport application and then restart the HTTP server.
7. Access JReport using the following URLs:

   `http://admin-pc/jreport/jrserver
   http://admin-pc/jreport/jinfonet/index.jsp`