Dispatching RMI Server Pages Requests in Multiple Server Environment
You can dispatch RMI Server Pages requests in multiple server environment, which includes Logi JReport clustered and non-clustered server environment.
Sample solution: dispatch RMI Server Pages requests in clustered server environment using customized dispatcher
This sample solution is to visit Server Pages JSPs remotely from WebSphere 7 to Logi JReport Clustered Server using customized dispatcher. See the below diagram for the structure:
You should be able to set up a similar service with any Java EE server by following the same procedure based on your preferred application server documentation.
This demo dispatcher dispatches requests from different sessions to different Logi JReport Servers according to Round-Robin algorithm. The dispatcher has the Fail Over function, which will periodically check whether there is any unavailable server in the cluster. No request will be dispatched to the unavailable server until the server is checked to be available again.
In general, the solution can be categorized into the following major steps:
- Set up the server cluster.
- Generate a WAR file containing Server Pages RMI JSP and dispatcher for WebSphere.
- Deploy the WAR file to WebSphere.
- Configure a clustered Logi JReport Server.
The following explains clearly the exact operations you are expected to make in each of the main steps.
Step 1: Setting up the server cluster
In this example we will set up two into the cluster using the Round-Robin algorithm.
192.168.0.1
192.168.0.2
Refer to Setting Up and Configuring a Logi JReport Server Cluster for the specific steps of setting up Logi JReport Server in a cluster.
Step 2: Generating a WAR file containing Server Pages RMI JSP and dispatcher for WebSphere
- Build a Logi JReport Server WAR file as defined by makewar.xml for remote integration. The generated WAR file is saved to the default directory
<install_root>\bin\distribute
.makewar.sh buildRemoteWar -Djrs.remote.host=192.168.0.1 -Djrs.remote.rmiport=1129 -Djrs.rmi.auth_file=/home/rmi.auth
- Compile the dispatcher DemoRemoteDispatcher.java stored in
<server_install_root>\help\samples\APICluster
with<server_install_root>\lib\JRESServlets.jar
and<server_install_root>\lib\jakarta.servlet-api-4.0.2.jar
. The class file DemoRemoteDispatcher.class and some other class files will be generated. - In the WAR file, drag the class files generated in step 2 to the remote.war\WEB-INF\classes\demodispath folder, assuming that this folder has already been created in the WAR file.
Step 3: Deploying the WAR file to WebSphere
- Start IBM WebSphere 7.
- Open Administrative Console. You can open Administrative Console using the Start Menu, or using the URL:
http://hostname:9060/ibm/console
, where hostname is host name or IP address, and 9060 is the port number. - After successfully logging in, expand the Applications node and then Application Types. Select WebSphere enterprise applications, and then select Install.
- Select Browse to select your .war file. In the Context root field, type a context path such as /remote/ ("/remote" is also ok). Keep selecting Next.
- Select Finish in the Summary page. The installing process may take several minutes, wait until the process is completed.
- After the installation process is completed, select Save directly to the master configuration. Then in the Save directly to the master configuration dialog, select Save.
- This step is to configure the dispatcher and cluster server. Go to WebSphere Admin Control to add some properties for this dispatcher. Expand Servers, go through Server Types > WebSphere application servers > server1 > Process definition (in the Server Infrastructure table > Java and Process Management) > Java Virtual Machine > Custom properties (in the Additional Properties table).
Select the New button to add properties for our demo dispatcher com.jinfonet.dispatcher.configFile and jrs.remote.dispatcher.
Figure 1: Add property for com.jinfonet.dispatcher.configFile
Figure 2: Add property for jrs.remote.dispatcher
Note that the dispatcher DemoRemoteDispatcher.java will read the clustered server information in the hostport.properties file like below:
rmiserver=192.168.0.1:1129
rmiserver=192.168.0.2:1130
... - If you have set up Logi JReport Server in a cluster, you can append their host and port information to the above text file.
- Select the Save link in the Messages table to save the changes, and then restart WebSphere 7.
Step 4: Configuring the Logi JReport Server Cluster
- Make sure Logi JReport Server has been started once in order that the server.properties file is generated.
- Change server.properties file in
<server_install_root>\bin
as follows:server.rmiserver.enable=true
server.rmiadminservice.enable=true
Then you can start Logi JReport Server and access your Server Pages with a URL such as:
http://hostname:9080/remote