Java EE PaaS using GlassFish 4.0 - JavaOne 2011 Technical Keynote
By arungupta on Oct 03, 2011
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:
- Download the sample application, unzip, and build as mvn package.
- Download platform-specific Load Balancer zip file (Windows, Mac, Ubuntu, Ubuntu-64).
- Download GlassFish 4.0
build b04 and unzip.
- Copy "lb.zip" to the "glassfish3\glassfish\config"
- 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..
- On Windows machines, the Load Balancer is created in the "C:\glassfish" directory.
- Check that you are able ping your hostname, such as ping `hostname`
- Start the domain as: asadmin start-domain
- Enable PaaS Console as: asadmin enable paas-console
- Configure GlassFish for the native mode as: asadmin create-ims-config-native
- Create a template for load balancer as: asadmin create-template --indexes ServiceType=LB,VirtualizationType=Native LBNative
- 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
- Copy "lb.zip" to the "glassfish3\glassfish\config" directory.
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.