You can dispatch RMI Server Pages requests in multiple server environment, which includes 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 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 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:
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 JReport Server Cluster for the specific steps of setting up JReport Server in a cluster.
Step 2: Generating a WAR file containing Server Pages RMI JSP and dispatcher for WebSphere
<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
<server_install_root>\help\samples\APICluster
with <server_install_root>\lib\JRESServlets.jar
and <server_install_root>\lib\javax.servlet-api-3.1.0.jar
. The class file DemoRemoteDispatcher.class and some other class files will be generated.Step 3: Deploying the WAR file to WebSphere
http://hostname:9060/ibm/console
, where hostname is host name or IP address, and 9060 is the port number.Click 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
...
Step 4: Configuring the JReport Server Cluster
<server_install_root>\bin
as follows:
server.rmiserver.enable=true
server.rmiadminservice.enable=true
Then you can start JReport Server and access your Server Pages with a URL such as:
http://hostname:9080/remote