Book Image

GlassFish Administration

By : Xuekun Kou
Book Image

GlassFish Administration

By: Xuekun Kou

Overview of this book

To build a powerful production environment for your Java EE systems, you need a great application server, and the skills to manage it. This book gives you all that you are looking for. This book will help you gain the necessary skills to install, configure, tune, and troubleshoot GlassFish so that you can fully unleash its power. It will teach you how to use the GlassFish application server, with a special focus on administration tasks. It presents the GlassFish administrative tasks in a logical sequence, with each chapter focusing on a specific topic. Starting with installation and moving through configuration, this book takes a careful look at the administration console so that you get a complete understanding of GlassFish and its administrative features. It will help you understand how to deploy Java EE, Ruby on Rails and other supported applications to GlassFish, and how to configure the necessary resources for these applications. You will also learn how to maintain, tune, and troubleshoot your GlassFish server. Also includes a bonus chapter introducing Glassfish v3.
Table of Contents (17 chapters)
GlassFish Administration
About the Author
About the Reviewers

Chapter 1. Getting Started

GlassFish Server has many exciting features which have all contributed to its rapid adoption. In this chapter, we provide a very high level overview of these features without going into a lot of technical detail. We will then describe how to install and update the GlassFish Server. The goal of this chapter is to help you gain a good understanding of the capabilities of GlassFish, install a working server instance, and most importantly, quickly get ready to explore the technical essence of the GlassFish Server in the subsequent chapters.

Introducing GlassFish

As a major step in Sun Microsystems' open source movement, the GlassFish project ( was launched in June 2005, during the Java One conference. The goal of the GlassFish project was to create an open source and production-ready Java EE application server. The Sun Java System Application Server ( SJSAS) 8.x provided the bulk of code base for GlassFish. Oracle also contributed to GlassFish by donating the code of EclipseLink (originally called TopLink Essentials), a high quality implementation of the Java Persistence API ( JPA).

GlassFish was originally licensed under the Common Development and Distribution License ( CDDL). It was later updated to allow dual license: CDDL and the GNU Public License ( GPL) v2 with the Class Path Exception ( CPE). This dual license structure allows GlassFish to be both friendly for commercial development (CDDL), and to enjoy the consistence of the Java SE's open source license (GPL).

A brief history of GlassFish

Three main versions of GlassFish Server have been released to date. The first version, GlassFish v1 and its commercially supported version, SJSAS 9.0 Platform Edition were announced at Java One in May 2006. The main goal of the GlassFish v1 was to showcase the improved productivity of developing enterprise applications using the Java Enterprise Edition (Java EE ) 5 technology. GlassFish v1 also implemented several features geared towards application administration and monitoring. Examples of these features included web service monitoring, call flow analysis, and management rule definitions. However, GlassFish v1 did not support clustering and session failover features that are essential for hosting large-scale, mission-critical applications. Due to this, GlassFish v1 was mostly suitable for department-level deployment and application prototyping. In fact, the release of GlassFish v2 effectively ren dered GlassFish v1 obsolete.

GlassFish v2, and the commercially supported SJSAS 9.1 (later renamed to Sun GlassFish Enterprise Server v2) were released in September 2007. The main goals of GlassFish v2 were to improve the performance, add enterprise class features, and further promote ease of development and use of GlassFish.

GlassFish v2 uses the new web service stack implemented in the Metro project ( GlassFish v2 supports the Web Service Interoperability Technologies (WSIT), a joint effort between Sun and Microsoft to improve the interoperation of web services developed in Java and Microsoft .NET technologies.

GlassFish v2 supports the Java Business Integration (JBI) specification, JSR-208. The GlassFish v2 distribution includes a JBI implementation developed in the OpenESB project ( This integration provides a unified installation, administration, and monitoring environment. With excellent support provided by tools such as the NetBeans IDE (, it is very easy to create and deploy composite applications that take advantage of both Java EE and JBI based services and components.

GlassFish v2 also introduced the concept of server usage profiles. A usage profile is characterized by the expected capabilities of an application installation. For each usage profile, the GlassFish Server provides a baseline configuration. The open source GlassFish v2 release supported two profiles. The developer profile is comparable to the Platform Edition of the SJSAS 9, which consumes the least amount of computing resources, and is suitable for development, prototyping, and small-scale deployment. The cluster profile supports the clustering of multiple application server instances and load balancing. The cluster profile also supports in-memory session replication, a light-weight yet very effective approach to improve the availability of the deployment. A third profile, enterprise is also supported in the commercially supported enterprise edition of GlassFish. The enterprise profile supports session replication using the High Availability Database (HADB), which further improves the availability of the application server deployment.

To date, the latest production release of the GlassFish Server is version 2.1.1. It is fully capable of hosting mission-critical enterprise applications. This book focuses on the administration and configuration of this version of GlassFish.

The development of GlassFish v3 started back in June 2008. One of the main goals of GlassFish v3 was to produce a production strength reference implementation of Java EE 6. Currently, the Java EE 6 standard is still being finalized. Because of this, there is no feature complete release of GlassFish v3 available yet. However, the GlassFish project has released the prelude and preview distributions of GlassFish v3 to showcase some exciting new features implemented. In this book, we dedicate the last chapter, a pretty long one, to GlassFish v3.

Understanding essential features of GlassFish

Since the project's launch, the GlassFish Server has enjoyed continuous improvement and significant growth. Many factors and features—both technical and non-technical—have contributed to the growing adoption of GlassFish. Let's examine some of them in the following sections.

Strong and active community

The GlassFish project provides an open and structured community for building and improving the GlassFish Server. The functional specifications, design documentation, software builds, and most recent production documentation of GlassFish are all made available through the project website. This allows the design and implementation of GlassFish to be reviewed and tested early and often. Also, the Aquarium Blog at provides up-to-date information about GlassFish. The information includes release announcements, technical meeting and event announcements, and the availability of new resources related to GlassFish.

Over time, the GlassFish community was expanded to cover more than just the GlassFish Server. The GlassFish project now includes a variety of sub-projects. Many of these sub-projects produce the core components for the GlassFish Server such as the Metro web service stack. Also, several sub-projects were launched to develop new products and components that reflect the current state of the enterprise computing.

An example of such a project is Jersey (, which provides an implementation of JSR-311: Java API for RESTful Services (JAX-RS). These projects form a strong foundation that assures the continuous improvement of GlassFish.

Judging from the amount of communication that has occurred on the GlassFish forum, e-mail lists, and the large number of times the GlassFish software has been downloaded and installed; the GlassFish project has been very active since its inception. You can find the download tracking and adoption information about GlassFish from sites such as and For example, in May 2009, GlassFish was downloaded more than 680,000 times, including all the distributions (The standalone distribution of the GlassFish Server runtime was downloaded more than 170,000 times). The download count was much higher than that of other popular open source application server products.

Here, we would like to make some brief comments on participating in an open source community. It is a common misconception that the only people contributing to an open source community are those who commit code changes. Actually, posting on discussion forums, sending e-mails to mailing lists, or writing about GlassFish have all helped form a great knowledge base. Such a knowledge base not only allows the GlassFish implementation quality to improve, but also allows more people to get familiar with the product and start using it more quickly.

Developer friendliness

As the reference implementation of the Java EE technologies, the GlassFish Server drives home the main goal of Java EE 5 and 6—ease of development. In addition to implementing the Java EE specifications, GlassFish provides many value-added features that help developers improve their productivity.

For example, GlassFish provides the built-in JAX-WS web service testing capability, which allows developers to quickly test their web service implementation. GlassFish allows applications to be automatically deployed in a development environment, and starting from GlassFish v3, new versions of an application can be deployed without destroying the client session.

GlassFish Server instances can be easily integrated into popular Integrated Development Environments (IDEs), such as NetBeans ( Eclipse ( When you develop Java EE applications, the IDE not only provides excellent support for creating and building components such as EJBs, it also allows developers to define necessary resources such as JDBC connection pools and data sources, and deploy them directly to the GlassFish Server. This feature allows a developer to stay in the development mindset without having to toggle between developing applications and configuring the application server.

Starting from version 3, GlassFish is expanded to provide first-class support for running a variety of popular programming languages and frameworks, such as Ruby on Rails, Groovy and Grails, and PHP. The NetBeans IDE was also updated to provide excellent support for developing applications using these technologies. Together, this allows developers with different technical backgrounds to build applications in the NetBeans IDE, and deploy them to the runtime environment that GlassFish delivers.

High quality implementation

The implementation of GlassFish has been constantly taking advantage of the latest developments in Java technology. Besides always being the first application server to supoprt the latest Java Development Kit (JDK) software, GlassFish also incorporates new developments in other related technologies. The development of GlassFish has produced some great components and frameworks that not only form the foundation of the GlassFish Server; they are also used in other products with great success. For example, the Metro project implements the web service stack of GlassFish, because of its excellent performance and interoperability with the Microsoft .NET technology, it is now used as the web service stack implementation in several other leading application server products. Another example is the Grizzly project ( Grizzly imple ments a highly scalable NIO framework that is used to implement the HTTP connectors in GlassFish. Nowadays, Grizzly is also used to build scalable server applications.

Sophisticated administration capability

The GlassFish Server provides a highly user friendly and complete administration infrastructure that is very rare in open source products. The administration capabilities of the GlassFish Server can be accessed through an intuitive web console, the command line interface (CLI), and Management Bean (MBeans) programmatically. These administration utilities are used to deploy applications, configure resources, manage the server, and monitor different aspects of the environment.

Configuration flexibility

GlassFish can be configured to use different components and frameworks. For example, instead of using TopLink Essentials as the Java Persistence API (JPA) provider, GlassFish can be configured to use Hibernate. The modular approach of GlassFish v3 further improves the flexibility of GlassFish. You can pick and choose only the modules necessary in your environment, thus, getting a custom-made server platform.

The journey the GlassFish Server has taken to get to its current stage almost mirrors the progress of the enterprise application development. GlassFish started as a proprietary application server that implements the J2EE standards in a monolithic architecture, and evolved into an open source, modular server that is very flexible for customization. While GlassFish continues to deliver a high performance Java EE application server platform, it also supports many new programming languages, frameworks, and technologies that can boost the development productivity significantly. For example, GlassFish can be used with a very lightweight configuration to host database-driven Rails applications; it can also be used with an enterprise-class configuration that provides services such as distributed transaction management.

High performance

Due to the quality of the core components, the performance of GlassFish Server is more than impressive. As the only open source application server that publishes the results of running the popular SPECjAppServer2004 benchmark for Java EE applications, GlassFish produces results that are comparable to or better than leading commercial products. You can get more information about the SPECjAppServer2004 benchmark and published results from the website