JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle GlassFish Server 3.1 Quick Start Guide
search filter icon
search icon

Document Information

1.  Quick Start for Basic Features

2.  Use Cases for Production Deployments

Deploying an Application to a Two-Instance Cluster

To Install and Configure the GlassFish Server Cluster

To Install and Configure iPlanet Web Server for Load Balancing

To Install the Load Balancer

To Deploy the Application and Configure the Load Balancer

Configuring an Oracle Data Source

To Integrate the JDBC Driver into GlassFish Server

To Create a JDBC Connection Pool

To Create a JDBC Resource

Next Steps

Configuring Transport Layer Security (TLS)

To Configure GlassFish Server for TLS/SSL

Shortcut for Configuring GlassFish Server for TLS/SSL

Shortcut: To Configure GlassFish Server for TLS/SSL

Deploying an Application to a Two-Instance Cluster

This example provides all the steps for configuring a cluster in which iPlanet Web Server is used with the load balancer plug-in for load balancing of two GlassFish Server instances. A simple web application is deployed to this cluster. Users of this application access the application through a virtual server.


Note - In this example, line breaks are included for enhanced readability. These line breaks are not part of the syntax of the commands.


The assumptions for this example are as follows:

The configuration of the cluster in this example is shown in the following figure.

Figure 2-1 Sample Two-Instance Cluster

image:Block diagram showing the configuration of the sample two-instance cluster

The following topics are addressed here:

To Install and Configure the GlassFish Server Cluster

All steps in this procedure are performed from the DAS host.

  1. Start the asadmin utility in multiple command mode (multimode).
    dashost$ asadmin
    Use "exit" to exit and "help" for online help.
  2. Set up public key authentication without encryption on the hosts where the instances will run.
    asadmin> setup-ssh sj01.example.com sj02.example.com
    SSH key not found for user gfuser
    Would you like to generate a SSH key pair (without a key passphrase) for gfuser to 
    access [sj01.example.com, sj02.example.com]? [y/n]: yes
    Enter SSH password for gfuser@sj01.example.com> 
    Created directory /home/gfuser/.ssh
    /usr/bin/ssh-keygen successfully generated the identification /home/gfuser/.ssh/id_rsa
    Copied keyfile /home/gfuser/.ssh/id_rsa.pub to gfuser@sj01.example.com
    Successfully connected to gfuser@sj01.example.com using keyfile 
    /home/gfuser/.ssh/id_rsa
    Successfully connected to gfuser@sj02.example.com using keyfile 
    /home/gfuser/.ssh/id_rsa
    SSH public key authentication is already configured for gfuser@sj02.example.com
    Command setup-ssh executed successfully.
  3. Copy the installation of GlassFish Server software from the DAS host to the hosts where the instances will run.
    asadmin> install-node --installdir /export/glassfish3 
    sj01.example.com sj02.example.com
    Created installation zip /home/gfuser/glassfish3033977962688704206.zip
    Successfully connected to gfuser@sj01.example.com using keyfile 
    /home/gfuser/.ssh/id_rsa
    Copying /home/gfuser/glassfish3033977962688704206.zip (90012883 bytes) to 
    sj01.example.com:/export/glassfish3
    Installing glassfish3033977962688704206.zip into sj01.example.com:/export/glassfish3
    Removing sj01.example.com:/export/glassfish3/glassfish3033977962688704206.zip
    Fixing file permissions of all files under sj01.example.com:/export/glassfish3/bin
    Successfully connected to gfuser@sj02.example.com using keyfile 
    /home/gfuser/.ssh/id_rsa
    Copying /home/gfuser/glassfish3033977962688704206.zip (90012883 bytes) to 
    sj02.example.com:/export/glassfish3
    Installing glassfish3033977962688704206.zip into sj02.example.com:/export/glassfish3
    Removing sj02.example.com:/export/glassfish3/glassfish3033977962688704206.zip
    Fixing file permissions of all files under sj02.example.com:/export/glassfish3/bin
    Command install-node executed successfully.
  4. Start the domain domain1.
    asadmin> start-domain domain1
    Waiting for domain1 to start ............................
    Successfully started the domain : domain1
    domain  Location: /home/gfuser/glassfish3/glassfish/domains/domain1
    Log File: /home/gfuser/glassfish3/glassfish/domains/domain1/logs/server.log
    Admin Port: 4848
    Command start-domain executed successfully.
  5. Enable secure administration for the DAS host.
    asadmin> enable-secure-admin
    Command enable-secure-admin executed successfully.
  6. Restart the domain domain1.
    asadmin> restart-domain domain1
    Successfully restarted the domain
    Command restart-domain executed successfully.
  7. Add the cluster pmdcluster to the DAS configuration.
    asadmin> create-cluster pmdcluster
    Command create-cluster executed successfully.
  8. Create a node for each host on which the instances will run.
    1. Create the node sj01 to represent the host sj01.example.com.
      asadmin> create-node-ssh --nodehost sj01.example.com 
      --installdir /export/glassfish3 sj01
      Command create-node-ssh executed successfully.
    2. Create the node sj02 to represent the host sj02.example.com.
      asadmin> create-node-ssh --nodehost sj02.example.com 
      --installdir /export/glassfish3 sj02
      Command create-node-ssh executed successfully.
  9. Add the instances pmd-i1 and pmd-i2 to the cluster pmdcluster.
    1. Add the instance pmd-i1 on the node sj01.
      asadmin> create-instance --node sj01 --cluster pmdcluster pmd-i1
      Command _create-instance-filesystem executed successfully.
      Port Assignments for server instance pmd-i1: 
      JMX_SYSTEM_CONNECTOR_PORT=28686
      JMS_PROVIDER_PORT=27676
      HTTP_LISTENER_PORT=28080
      ASADMIN_LISTENER_PORT=24848
      JAVA_DEBUGGER_PORT=29009
      IIOP_SSL_LISTENER_PORT=23820
      IIOP_LISTENER_PORT=23700
      OSGI_SHELL_TELNET_PORT=26666
      HTTP_SSL_LISTENER_PORT=28181
      IIOP_SSL_MUTUALAUTH_PORT=23920
      The instance, pmd-i1, was created on host sj01.example.com
      Command create-instance executed successfully.
    2. Add the instance pmd-i2 on the node sj02.
      asadmin> create-instance --node sj02 --cluster pmdcluster pmd-i2
      Command _create-instance-filesystem executed successfully.
      Port Assignments for server instance pmd-i2: 
      JMX_SYSTEM_CONNECTOR_PORT=28686
      JMS_PROVIDER_PORT=27676
      HTTP_LISTENER_PORT=28080
      ASADMIN_LISTENER_PORT=24848
      JAVA_DEBUGGER_PORT=29009
      IIOP_SSL_LISTENER_PORT=23820
      IIOP_LISTENER_PORT=23700
      OSGI_SHELL_TELNET_PORT=26666
      HTTP_SSL_LISTENER_PORT=28181
      IIOP_SSL_MUTUALAUTH_PORT=23920
      The instance, pmd-i2, was created on host sj02.example.com
      Command create-instance executed successfully.
  10. Start the cluster pmdcluster.
    asadmin> start-cluster pmdcluster
    Command start-cluster executed successfully.
  11. Confirm that the instances in the cluster pmdcluster are running.
    asadmin> list-instances
    pmd-i1   running  
    pmd-i2   running  
    Command list-instances executed successfully.
  12. End the multimode session for the asadmin utility.
    asadmin> exit
    Command multimode executed successfully.

To Install and Configure iPlanet Web Server for Load Balancing

All steps in this procedure are performed from the host where the web server and load balancer plug-in will run.

Before You Begin

This example assumes that the path of user gfuser contains the /home/gfuser/webserver7/bin directory.

  1. Download the web server software from the Oracle iPlanet Web Server 7.0.9 download page.
  2. Extract the contents of the download file.
    lbhost$ unzip Oracle-iPlanet-Web-Server-7.0.9-solaris-sparc.zip
  3. Start the iPlanet Web Server installation wizard.
    lbhost$ setup &
  4. Follow the onscreen instructions in the installation wizard to install iPlanet Web Server.

    Other steps in this procedure assume the following option settings:

    • Installation Directory: /home/gfuser/webserver7

    • Type of Installation: Express

    • Administrator User Name: admin

    • Start Administration Server: checked

  5. Start the wadm utility in multimode.
    lbhost$ wadm --user=admin
    Please enter admin-user-password> 
    Connected to localhost:8989
    Oracle iPlanet Web Server 7.0.9 B07/04/2010 02:15
  6. Create a self-signed certificate for secure communication between the load balancer plug-in and the DAS.
    wadm> create-selfsigned-cert --server-name=lbhost.example.com 
    --nickname cert-lbhost --token=internal --config=lbhost
    CLI201 Command 'create-selfsigned-cert' ran successfully
  7. Create a secure HTTP listener for the iPlanet Web Server instance lbhost.
    wadm> create-http-listener --server-name lbhost.example.com 
    --default-virtual-server-name=lbhost --listener-port 8082 
    --config lbhost http-listener-ssl
    CLI201 Command 'create-http-listener' ran successfully
  8. Enable SSL with optional client authentication and assign the certificate for the HTTP listener.
    wadm> set-ssl-prop --http-listener http-listener-ssl --config lbhost enabled=true 
    client-auth=optional server-cert-nickname=cert-lbhost
    CLI201 Command 'set-ssl-prop' ran successfully
  9. Deploy the configuration for the iPlanet Web Server instance lbhost.
    wadm> deploy-config lbhost
    CLI201 Command 'deploy-config' ran successfully
  10. End the multimode session for the wadm utility.
    wadm> exit

To Install the Load Balancer

Unless otherwise stated, all steps in this procedure are performed from the host where the web server and load balancer plug-in will run.

  1. From the DAS host, export the self-signed certificate of the DAS to enable secure communication between the HTTP listener and the DAS.
    dashost$ keytool -export -rfc -alias s1as 
    -keystore /home/gfuser/glassfish3/glassfish/domains/domain1/config/keystore.jks 
    -file ./s1as.rfc
    Enter keystore password:  
    Certificate stored in file <./s1as.rfc>
  2. Transfer the DAS certificate file s1as.rfc from the DAS host to the host where the web server and load balancer plug-in will run.
  3. Download the GlassFish Loadbalancer Configurator 3.1 from the Components section of the Oracle GlassFish Downloads page.
  4. Extract the contents of the download file.
    lbhost$ unzip glassfish-lbconfigurator-3_1.zip
    Archive:  glassfish-lbconfigurator-3_1.zip
      inflating: glassfish-lbconfigurator-3_1.jar
  5. Start the GlassFish Loadbalancer Configurator.
    lbhost$ java -jar glassfish-lbconfigurator-3_1.jar
  6. Follow the onscreen instructions in the GlassFish Loadbalancer Configurator to install and configure the load balancer plug-in.

    Other steps in this procedure assume the following option settings:

    • Web Server Instance Directory: /home/gfuser/webserver7/https-lbhost

    • DAS Certificate File: s1as.rfc

  7. Start the iPlanet Web Server instance lbhost, to which the load balancer plug-in was installed.
    lbhost$ wadm start-instance --user=admin --config=lbhost
    Please enter admin-user-password> 
    CLI204 Successfully started the server instance.

To Deploy the Application and Configure the Load Balancer

All steps in this procedure are performed from the DAS host.

Before You Begin

This example assumes that the host name pmd.example.com is registered with the DNS server for the example.com domain.

  1. Start the asadmin utility in multimode.
    dashost$ asadmin
    Use "exit" to exit and "help" for online help.
  2. Create the virtual server pmdserver to represent the virtual host pmd.example.com.
    asadmin> create-virtual-server --hosts pmd.example.com 
    --networklisteners http-listener-1 --target pmdcluster pmdserver
    Command create-virtual-server executed successfully.
  3. Deploy the hello application to the cluster pmdcluster.
    asadmin> deploy --availabilityenabled=true --target pmdcluster 
    --virtualservers pmdserver /home/gfuser/apps/hello.war 
    Application deployed with name hello.
    Command deploy executed successfully.
  4. Create the HTTP load balancer configuration pmdcluster-lb-config for the cluster pmdcluster.
    asadmin> create-http-lb --devicehost lbhost.example.com 
    --deviceport 8082 --target pmdcluster --lbenableallinstances 
    --lbenableallapplications=hello pmdcluster-lb-config
    Command create-http-lb executed successfully.
  5. Apply the HTTP load balancer configuration pmdcluster-lb-config.
    asadmin> apply-http-lb-changes pmdcluster-lb-config
    Command apply-http-lb-changes executed successfully.
  6. End the multimode session for the asadmin utility.
    asadmin> exit
    Command multimode executed successfully.
  7. To access the application, open the location https://pmd.example.com:8082/hello/ in a web browser.