Sun Microsystems Logo





Sun Java (tm) System Application Server Enterprise Edition 7 2004Q2
Sample Applications




Sample applications packaged for Enterprise Edition release simply demonstrate session persistence, clustering - fail over, and high availability and reliability features.
 
 
  ee-samples/ Sample J2EE[tm] Web Application for EE 
clusterjsp/
Simple JSP web application to demonstrate session persistence and high availability
dukesbookstore/
A JSP based Duke's Bookstore application that demonstrates HttpSession persistence and fail over capability of the Application Server
sessionstorage/
Allow user to experiment with different HA session configuration, to determine how different session size and complexity is handled with each configuration
product/
A simple CMP 2.0 EJB application stores Entity EJBObject reference in HttpSession for fail over
roster/
A set of CMP 2.0 EJBs application with Local interfaces which stores the LocalEJBHome reference in HttpSession for fail over
sfsbfailover/
A simple Shopping Cart application to demonstrate SFSB failover



Setting up

Please refer to the Installation Guide for Sun Java (tm) System Application Server Enterprise Edition 7 2004Q2 for details.
The following is simple instruction on how to configure Load Balancer and HADB for Application Server instances for sample applications to demonstrate session persistence, high availability, and failover capabilities.

Minimum requirement is to have at least two application server instances installed on either collocated (same) or non-collocated (different) machine. To make it simple, this document will refer to the collocated case with assumption that you have enough CPU and memory on specified machine.


If the WebServer is installed on the same machine as application server instances, then make sure the port number does not conflict.

After installed the Load Balancer Plugin, configure the loadbalancer.xml file as follows:

<!DOCTYPE loadbalancer PUBLIC "-//Sun Microsystems Inc.//DTD Sun ONE Application Server 7.0//EN" "sun-loadbalancer_1_1.dtd">
<loadbalancer>
  <cluster name="cluster1">
    <instance  name="instance1" enabled="true" disable-timeout-in-minutes="60" listeners="http://host:port"/>
    <instance  name="instance2" enabled="true" disable-timeout-in-minutes="60" listeners="http://host:port"/>
    <web-module context-root="clusterjsp" enabled="true" disable-timeout-in-minutes="60"/>
    <web-module context-root="dukesbookstore" enabled="true" disable-timeout-in-minutes="60"/>
    <web-module context-root="SessionStorage" enabled="true" disable-timeout-in-minutes="60"/>
    <web-module context-root="productClient" enabled="true" disable-timeout-in-minutes="60"/>
    <web-module context-root="RosterClient" enabled="true" disable-timeout-in-minutes="60"/>
    <web-module context-root="sfsbFailover" enabled="true" disable-timeout-in-minutes="60"/>
    <health-checker url="/" interval-in-seconds="10" timeout-in-seconds="30"/>
  </cluster>
  <property name="reload-poll-interval-in-seconds" value="60"/>
  <property name="response-timeout-in-seconds" value="30"/>
  <property name="https-routing" value="true"/>
  <property name="require-monitor-data" value="true"/>
</loadbalancer>


Deployment for cluster

Please refer to Administrator's Guide for Sun Java (tm) System Application Server Enterprise Edition 7 2004Q2, Chapter 20 on how to use cladmin command for details to register resources and deploy application to a cluster.

Starting Application Server Admin and then follow the instruction to register resources for samples and then deploy application for each instance based on the document for each sample.

You can do the following steps to deploy sample applications to all instances in the cluster (based on the data in file clinstance.conf):

Go to <AS_install_dir>/samples/ee-samples/<sample_name>
<AS_install_dir>/bin/cladmin deploy --type web --name <sample_name>  <sample_name>.war
OR
<AS_install_dir>/bin/cladmin deploy --type application --name <sample_name>  <sample_name>.ear

For example,
Go to <AS_install_dir>/samples/ee-samples/clusterjsp  and run
<AS_install_dir>/bin/cladmin deploy --type web --name clusterjsp clusterjsp.war

OR

Go to <AS_install_dir>/samples/ee-samples/product  and run
<AS_install_dir>/bin/cladmin deploy --type application --name ProductApp ProductApp.ear
 

Running application

To simulate the failover capability: