Skip to main content

Virtual clustering in GlassFish 4 : focus on the VMware plugin

Posted by serli on December 8, 2011 at 1:56 AM PST

GlassFish 4 will be the JAVA EE 7 reference implementation. This new version is to be released on Q3, 2012 but promoted builds can already be downloaded : The main idea of this future release is to provide GlassFish as a PAAS solution.

GlassFish 4 will be shipped with a new component called PAAS console. This component is a GUI that allows to deploy and monitor an application in a cloud environment. GlassFish 4 will be able to dynamically provision the services (load-balancer, Java EE, database ... ) needed by the application. The number and type of services to be deployed can be specified explicitly by adding an XML configuration file in the application archive, or determined implicitly by GlassFish. The user will also have the possibility to set up quality of service requirements for his application, GlassFish relying on some auto-scaling features to meet these requirements. If you want to try GlassFish 4, Arun Gupta has already written a really nice article : 

In GlassFish 4, the underlying physical infrastructure will be managed using virtual clustering. A virtual cluster is made up of a list of server pools. A server pool can be either a group of physical machines or a reference to a public cloud. Each server pool is associated with one virtualization plugin which is responsible of the communication with its machines or its cloud API.


A virtualization plugin has the responsibility to :

  • create virtual machines in the server pool
  • handle the lifecycle of the created virtual machines (pause, resume, delete ... )
  • retrieve resource usage
  • possibly add/remove machines in the server pool

A VM (virtual machine) provides one service instance for an application. To create a VM, a virtualization plugin needs a VM template. Each template is associated with one service type, meaning that all the VMs created from a template will provide an instance of the same service. To deploy a cloud application, you will probably need at least a load-balancer template and a JavaEE template.

One virtualization plugin can usually handle only one kind of machine or one cloud API. For example, an OVM plugin is expected to be developed to manage OVM servers only. But in GlassFish 4, everything has been designed to make the integration of new virtualization plugins easy. A plugin provides an HK2 service that implements a ServerPool interface. Thanks to HK2 dynamic service discovery, the plugin can automatically be used by GlassFish at runtime. Consequently, since GlassFish is open source, it is possible for anybody to develop and offer his own plugin.

At SERLI, we are currently developing a VMware plugin to allow GlassFish to deploy services on VMware ESX and ESXi machines (versions 3.5 to 5).

A template for the VMware plugin is made up of a VMDK virtual disk and optionally a VMX file. The VMDK is a virtual disk on which an OS and some applications have been installed (for example : JeOS + GlassFish for a JavaEE template). The VMX file allows to specify the physical parameters of the VMs that will  be created from this template. The interaction with the hypervisors is provided by VI Java (



Example of a VMX file

for the VMware plugin


A demonstration of virtual clustering in GlassFish 4 can be found at :

Thank you very much to the GlassFish team, especially Alexis Moussine-Pouchkine and Jérôme Dochez for their time and effort.

Fabien Leroy



Related Topics >>