Java EE PaaS using GlassFish 4.0 - JavaOne 2011 Technical Keynote

Guest Author

The JavaOne 2011 Technical Keynote explained how a Java EE application can be
easily deployed in a PaaS environment using GlassFish 4.0.

The Java EE application, built from scratch, 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


  • 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.

  • 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.

  2. Download platform-specific Load Balancer zip file (Windows,




  3. Download GlassFish 4.0

    build b04
    and unzip.

    1. Copy "lb.zip" to the "glassfish3\glassfish\config"


      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


    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


    6. Follow the instructions in the video below (starting at 5:24) to

      deploy the application using PaaS Console. Applications not using

      database functionality or not relying upon a SQL for the database

      initialization can be deployed using CLI as: asadmin --availabilityenabled=true


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



An active copy of this page is maintained at


Join the discussion

Comments ( 8 )
  • guest Thursday, October 6, 2011

    do you have a link to install.bat so we can directly download it?

  • michaelc Tuesday, October 11, 2011

    I recall that in the JavaOne session Elasticity in the Cloud it was mentioned that this elasticity framework can be used independently from GlassFish? if that's the case any pointers on how to do that?


  • guest Wednesday, October 12, 2011


    install.bat is:

    set number=b04

    set GLASSFISH=%number%\glassfish3

    set ASADMIN=%GLASSFISH%\bin\asadmin

    rem CLEAN UP

    rmdir /s /q C:\glassfish

    rmdir /s /q %GLASSFISH%

    "c:\Program Files\7-Zip\7z.exe" -o%number% x \Downloads\glassfish\glassfish-4.0-%number%.zip

    copy \Downloads\lb2.zip %GLASSFISH%\glassfish\config\lb.zip

    mkdir %GLASSFISH%\glassfish\databases

    copy \Downloads\derby.properties %GLASSFISH%\glassfish\databases

    call %ASADMIN% start-domain

    call %ASADMIN% enable paas-console

    call %ASADMIN% create-ims-config-native

    call %ASADMIN% create-template --indexes ServiceType=LB,VirtualizationType=Native LBNative

    call %ASADMIN% create-jvm-options -Dorg.glassfish.paas.orchestrator.parallel-provisioning=true

    and uninstall.bat is:

    set number=b04

    set GLASSFISH=%number%\glassfish3

    set ASADMIN=%GLASSFISH%\bin\asadmin

    call %ASADMIN% undeploy ConferencePlanner

    call %ASADMIN% stop-domain


    I've asked the elasticity folks to respond to your comment, stay tuned!

  • guest Thursday, October 13, 2011

    To use GlassFish Elasticity module independently, you need the nucleus distribution. Will post the link to that shortly. Note that this is still work in progress. So, expect more changes in the elasticiity module

  • guest Thursday, October 13, 2011

    To use GlassFish Elasticity module independently, you need the nucleus distribution. Will post the link to that shortly. Note that this is still work in progress. So, expect more changes in the elasticiity module

  • dndimitrov Monday, October 24, 2011

    Thank you for the excellent Demo!

    Are those functionalities going to

    be available in the Open Source version too?

  • guest Monday, October 24, 2011


    This demo uses GlassFish Open Source Edition only :-)

  • Binh Nguyen Sunday, November 13, 2011

    Thanks for your demo + source code. I downloaded your sharing code then I'll learn how to develop a Java EE 6 App from your sample.

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.