Running your Java EE Applications in a PaaS

JavaOne 2011 and Devoxx 2011 Keynote Demo

This page describes a Java EE sample application and explains how it can be easily deployed in a PaaS environment using GlassFish 4.0.

The application allows conference organizers to publish details about their conference such as tracks, sessions, and speakers. It also allows attendees to register for the conference and prepare their schedule. The application is built as a typical 3-tier Java EE 6 application using JavaServer Faces (with PrimeFaces widgets) for the front-end, Enterprise JavaBeans for the middle tier business logic, and Java Persistence API for connectivity with the database.

Deploying this application to GlassFish 4.0 highlights the following points:

  • Dynamic Service Provisioning: The service dependencies are discovered by introspecting the application archive and the required services such as Java EE, Database, and Load Balancer are provisioned. These services may be provisioned as part of an application deployment as is the case here, or a deployment can use pre-provisioned services that could be shared by different apps.
  • Elasticity using Auto-scaling: The Java EE cluster is automatically resized to meet the growing demands using auto-scaling. The decision to dynamically grow or shrink is based upon metrics that are collected during the application flow (see also this other demonstration for more details on elasticity).
  • Highly Available Cluster: The Java EE cluster is highly available with session failover capabilities.

GlassFish 4.0 is a release in development that will allow for PaaS environments in the native and virtualized mode. The native mode provisions all the services on a non-virtualized environment such as a laptop/desktop and easy-to-replicate development and debugging mode. The virtualized mode allows a PaaS administrator to provision all the services in a private or public cloud, in an IaaS-agnostic manner, and provides for scalable deployments by supporting Elasticity to scale up (vertically) or scale out (horizontally) and to scale down to meet the changing needs. The Service Provisioning and Elasticity functionalities can be automatically done by the system or allow for manual action.

Follow the instructions to deploy this application in the native mode:

  1. Download the sample application, unzip, and build as mvn package.

    Note: The older version of the application can be downloaded here.
  2. Download platform-specific Load Balancer zip file (Windows, Mac, Ubuntu, Ubuntu-64) and rename it to "".
  3. Download GlassFish 4.0 build b05 and unzip.
  4. Configure GlassFish: Other than LB configuration in 4.1.1, 4.1.2, and 4.1.3, all other steps can be executed using "bin/" script.
    1. Copy "" to the "glassfish3\glassfish\config" directory.
      1. On Unix machines, the Load Balancer is installed in the directory "/u01/glassfish". Make sure to create this directory and change directory ownership to your login id.
      2. On Windows machines, the Load Balancer is created in the "C:\glassfish" directory.
      3. Check that you are able ping your hostname, such as ping `hostname`
    2. Start the domain as: asadmin start-domain
    3. Enable PaaS Console as: asadmin enable paas-console
    4. Configure GlassFish for the native mode as: asadmin create-ims-config-native
    5. Create a template for load balancer as: asadmin create-template --indexes ServiceType=LB,VirtualizationType=Native LBNative
  5. Follow the instructions in the video below (starting at 5:24) to deploy the application using PaaS Console. Make sure to pick javaone-sf-2011.sql for database initialization such that JavaOne San Francisco 2011 conference data is loaded. Pick devoxx-2011.sql if Devoxx 2011 conference data needs to be loaded.

    Applications not using database functionality or not relying upon a SQL for the database initialization can be deployed using CLI as: asadmin deploy --availabilityenabled=true <APP-NAME>.war

Enjoy the video below for a more detailed explanation of the installation steps, application flow, dynamic service provisioning, high availability and session failover, and auto-scaling using elasticity in the virtualized mode.


Send us feedback at the GlassFish Forums.