Get to know GlassFish Community, the differences between Oracle GlassFish Server, and also all the capabilities for Management, Administrative tasks, Monitoring, Tuning and Configuration for Production Environments of all your Java EE applications
Let’s begin by talking about what’s new in Java EE 7, and as a result, are also available in GlassFish 4.0
Java EE has gone through many releases, starting back in 1998. The early releases focused on building out the platform to meet the needs of the industry as the web gained rapid adoption. As a result of this rapid growth and the focus on features, J2EE (as it was called up to J2EE 1.4) became a difficult platform for developers to develop to. In fact, this spawned some open source projects like JPA and Spring that addressed developer ease-of-use.Of course, ease-of-use is relative, and beginning with Java EE 5 in 2005, Java EE moved ease of use and developer productivity to the forefront, and remain release themes for Java EE 7 today! Unlike some frameworks, Java EE 5 adopted “convention of configuration” and “annotated object” as the primary approach to developing server-side applications. Java EE 6 added the Web Profile, which is a subset of the full platform targeted at Web applications. Because many of the enterprise connectivity features are not in the Web Profile, it is simpler to pick up and learn, is more lean, and has even helped to grow the Java EE ecosystem with new vendors supporting only the Web Profile.Java EE 7, which we’ll talk about in detail, continues to focus on developer productivity, and emphasizes HTML5 development.
Java EE 7 has three main themes. First and foremost, it lays the foundation for HTML5 development. WebSockets offer low-latency, bi-directional data exchange that enable highly dynamic data exchange between browser and rich clients, and the server. Servlets gained asynchronous support in Java EE 6, enabling more scalable applications because more requests could be handled concurrently. Servlet 3.1 NIO (Non-blocking I/O) adds additional scalability through an event-driven API that enables the server to read data from a client as it becomes available and avoid blocking. This is useful, for example, when clients have low-bandwidth connections, and we don’t want the server to have to wait for all the data to be read. Like Servlet 3.0 in Java EE 6, JAX-RS 2.0 in Java EE 7 adds asynchronous support, enabling more scalable RESTful applications. Java EE 7 also adds a JSON Processing API for portable data exchange. This enables JSON objects to be read and written when communicating with Java and non-Java clients. This API offers both streaming and Document Object Model APIs, similar to JAX-WS and JAX-B for XML.Java EE makes developing HTML5-enabled and enterprise applications more productive than ever. Java EE 7 introduces new annotated Plain-Old-Java-Objects, or POJOs, simplifying application development even further. For example, a beans.xml file is no longer required to use dependency injection, and transactions are supported in virtually any POJO by simply using the @Transactional annotation. Developers write less boilerplate code with a much simpler JMS API. What used to take 18 lines of code to send a message now only requires a single line of code. The platform also adds default resources, where developers can depend on a resource being pre-configured for deployed applications. Last, the platform is highly integrated. For example, the Bean Validation API enables developers to define constraints on values, like “a string can not be null and must be less than 20 characters”. The Bean Validation API can now apply to JAX-RS resource parameters, and on POJO method parameter and return value.The third area of focus for Java EE 7 is meeting enterprise demands. Two new features are Batch and Concurrency Utilities APIs. The Batch feature is a rich API that enables developers to define batch that can be non-interactive, bulk-oriented and are long-running tasks that are computationally intensive, can execute sequentially or parallel, and may be initiated ad hoc or through scheduling. Batch processing also effectively utilizes computing resources by shifting processing times to when resources are typically idle. The Java EE platform is a managed environment that frowns on developers spawning their own non-managed threads to improve application scalability. The Concurrency Utilities for Java EE APIs enable developers to define and prioritize tasks that can be run in a dedicated thread pool, improving application scalability.
While Oracle is the steward of Java EE and leads the specification, Java EE is truly a community effort. Many organizations, individuals, and even Java User Groups are involved in the definition of Java EE. Some organizations and industry experts define the features, many others provide feedback throughout the process, and even create applications to test the proposed APIs and reference implementation that offer feedback. Of course, we encourage the involvement of everyone we talk to to become involved in the definition of the platform.
While GlassFish Server is the reference implementation, it is developing in open source.
The benefit of being developed in open source is the feedback and contributions of a vibrant developer community. GlassFish Server, for a period of time, is the only Java EE 7 implementation available until other implementations are able to pass the compatibility test suite. Developers that want to learn the latest APIs flock to GlassFish to learn the latest and greatest features of the Java EE platform. Developers also like GlassFish because it is modular, lightweight, and starts in seconds. Because of this, most developers use the full Java EE 7 platform builds, although some do use the Web Profile builds as well. Organizations often take their applications developed on GlassFish into production.
GlassFish server is extremely popular, with over ten million annual downloads. Students learn Java EE on GlassFish, and rofessionaldeveloperswant write applications using the latest standards and features. There is also a community of developers that are involved in FishCAT, the program that helps improve the quality of GlassFish. Developers test new features and read the documentation, looking for bugs in either case. Bugs found using FishCAT are prioritized over other bug fixes, which encourages more participation. The mailing lists are very active with participation from the product team, individuals, and organizations. The community also contributes features. For example, Serli, a company in France, has contributed application versioning feature, which we’ll discuss shortly.
While GlassFish Server is a great development platform, it is also used in many production environments. One reason are the “production” features that GlassFish Server offers. For example, GlassFish includes the ability to provision instances to remote hosts using SSH or DCOM. Clusters can be created securely without logging into a remote server to install software – just let GlassFish do it for you. GlassFish can manage the lifecycle of clusters and instances, by creating, start, stopping, and removing them. Instances and clusters can also share a common configuration or each can have their own. The configurations are all managed centrally. Resources like database and JMS connections are also managed from a central location, Last, applications can be deployed, enable, disable, and removed in a centralized manner.
GlassFish Server has three administration channels that offer feature rich administration features. From the web console, administrators can manage the lifecycle of instances, clusters, and applications. They can define resources, and upgrade GlassFish itself. Whatever can be done through the administration console can also be done through the command line, so admins can create shell scripts for complete automation. Anything that can be done through the web console and CLI can also be done using the RESTful API, so developers can programmatically control GlassFish as well.
At the center of the GlassFish Server architecture is the Domain Administration Server, or DAS for short. It is used to manage multiple configurations, applications, clusters, and instances. [LEFT] Developers and administrators interact with the DAS using the administration console, their favorite IDE, the “asadmin” command line tool, or RESTful API. Interaction occurs over HTTP or by using GlassFish APIs (such as the embedded API).[RIGHT] The DAS interacts with remote clusters using ssh and/or http. SSH can be used to manage the lifecycle of clusters and standalone instances (create, start, stop, destroy).Existing GlassFish Server 2.x users will notice that we have replaced the node agent architecture by leveraging the use of SSH. Note that SSH is actually optional, so instance lifecycle management can be done by logging in to a remote server and manually creating/start/stopping/destroying instances.
GlassFish Server manages 100 instances per domain, and these can be broken into 100 standalone instances, 50 2-node clusters, and up to 10 10-node clusters. Instances can be added or removed to a cluster at runtime. JMS brokers, based on OpenMQ, can be clustered as well, with persistent messages being stored on the filesystem or in a database. Oracle GlassFish Server, the commercial offering from Oracle, includes a load-balancer plugin. However, Oracle also tests mod_jk and mod_proxy, or basically the AJP protocol, as an open source option.
Application Versioning is a feature that is was contributed by Serli, a consulting company out of France. Application versioning allows for multiple versions of an application to be deployed simultaneously, although only one can be active at a time. This provides the ability to quickly and easily roll forward and backwards as required to meet business needs.
GlassFish Server is a modular application server build on an OSGi runtime.<CLICK> When you first start Glassfish, only a few modules are loaded. This is why GlassFish server starts in seconds.<CLICK> When an application is deployed, only the modules required to service running applications are loaded, minimizing resource utilization.<CLICK> When running applications, some additional modules will be loaded to support clustering, or when the web console is used, for example
GlassFish Server 4.0 is built on an OSGi runtime, and ships Apache Felix by default, although we do test with other OSGi implementations as well. GlassFish has roughly 275 modules. Developers can manage OSGI modules using Apache Felix OSGi tools or through the Felix Web console that integrates with the GlassFish console. Oracle does not formally support managing GlassFish modules in this manner, but OSGi developers can use it to manage their modules.GlassFish also supports “hybrid” applications, where OSGi resources can be injected into Java EE applications, and EJBs can be looked up from an OSGi bundle as if they were OSGi services.Because GlassFish runs on a generic OSGi runtime, any OSGi bundle can be deployed to the GlassFish runtime.OSGi also suports OSGi Enterprise, which is a way of making Java EE services like JDBC, JPA, and Web Applications.
GlassFish Server is also extensible. Developers can create new OSGi-based services and run them in GlassFish. Developers can then create administrative commands that integrate with the GlassFish infrastructure and be exposed through the console, CLI, or RESTful interface.GlassFish also includes an embedded API, so GlassFish can be embedded into an existing JVM to integrate with an existing application, or can be used in Unit testing environments.ISVs can also re-brand the user interface to offer a custom look and feel such as color themes, logo, etc.
GlassFish offers fast application deployment and redeployment. Applications can be deployed and redeployed to a live instance by dropping a war file into an auto-deploy directory, or by using a scattered archive in an exploded manner, like when using popular IDEs and their directory structures.GlassFish can be started using the asadmin CLI tool, or by simply running java –jar. The application server is quite flexible. Developers can also use the GlassFish maven plugin to start GlassFish, deploy applications, etc, which is very useful for testing in a continuous integration environment.
Developers love to use ActiveRedeploy, which is a feature that maintains the state of HTTP and EJB sessions across redeployments. Using NetBeans or Eclipse, developers can edit a file. Save it, and simply refresh the browser page. The IDE with the GlassFish plugin will compile the code and automatically redeploy the application. Imaging writing a shopping cart-like application where the contents of the cart do not change across redeployments. Developers can focus on writing business logic and not have to re-fill the cart just to test a new piece of code.
NetBeans 7.3.1 offers the strongest Java EE 7 features and GlassFish integration. NetBeans actually bundles GlassFish 4.0. In addition to active redeploy, it offers complete Java EE 7 support, with wizards that generate the outline of a POJO and the developer can customize it as needed. There are also some advanced wizards that actually generate RESTful endpoints from a JPA entity, one a wizard that generates a JSF CRUD interface to database tables.
While GlassFish is the reference implementation and is built in open source, Oracle also offers Oracle GlassFish Server as a commercially supported product.