Java EE PaaS using GlassFish 4.0 - JavaOne 2011 Technical Keynote

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 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.
  • 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, Mac, Ubuntu, Ubuntu-64).
  3. Download GlassFish 4.0 build b04 and unzip.
    1. Copy "lb.zip" 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
    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 <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.

An active copy of this page is maintained at glassfish.org/javaone2011.

 

Comments:

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

Posted by guest on October 06, 2011 at 12:39 AM PDT #

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?

Thx

Posted by michaelc on October 11, 2011 at 01:17 PM PDT #

guest,

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

michaelc,

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

Posted by guest on October 12, 2011 at 04:49 PM PDT #

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

Posted by guest on October 13, 2011 at 02:33 AM PDT #

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

Posted by guest on October 13, 2011 at 02:35 AM PDT #

Thank you for the excellent Demo!
Are those functionalities going to
be available in the Open Source version too?

Posted by dndimitrov on October 24, 2011 at 01:03 AM PDT #

dndimitrov,

This demo uses GlassFish Open Source Edition only :-)

Posted by guest on October 24, 2011 at 01:17 AM PDT #

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.

Posted by Binh Nguyen on November 12, 2011 at 11:25 PM PST #

Post a Comment:
Comments are closed for this entry.
About

profile image
Arun Gupta is a technology enthusiast, a passionate runner, author, and a community guy who works for Oracle Corp.


Java EE 7 Samples

Stay Connected

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today