Tuesday, January 31, 2012

Book Review: JBoss AS 7: Configuration, Deployment, and Administration

I eagerly accepted Packt Publishing's invitation to review JBoss AS 7: Configuration, Deployment, and Administration because it has been several years since I last used JBoss and I was curious to learn more about JBoss AS 7. I have already written about my First Impressions of Book 'JBoss AS 7 Configuration, Deployment and Administration' and in this post I review the book in greater detail while attempting to minimize how much I repeat from that post. My review is based on an electronic (PDF) copy of JBoss AS 7: Configuration, Deployment, and Administration.

General Features

JBoss AS 7: Configuration, Deployment, and Administration highlights particularly important notes and warnings within boxing that makes them obvious and with an icon representing a pencil and paper. Similarly, tips and tricks also attract special attention with similar boxing and with a light bulb icon. It is helpful to have the most important notes and tips and tricks highlighted like this.

It didn't take much reading of this book to realize how significantly new JBoss AS 7's architecture is. One of the strengths of JBoss AS 7: Configuration, Deployment, and Administration is its comparisons of previous versions of JBoss AS to JBoss AS 7. These comparisons help to understand how changed JBoss AS 7 is and should be especially helpful to anyone migrating to JBoss AS 7 from a previous version.

This book provides several tables of various configuration options and their descriptions. These tables provide easy reference for various configuration options. Although I mostly just skimmed these as I read this book, I noted their existence for future reference when configuring various parts of JBoss AS 7.

Command line interfaces and script-based configuration and administration are emphasized throughout the book. I appreciate this because I tend to use command line approaches far more frequently than I use graphical tools, but some books focus almost exclusively on the graphical tools.

Perhaps the greatest strength of JBoss AS 7: Configuration, Deployment, and Administration is its focus on what its title promises: configuration, deployment, and administration. Although this book does provide brief introductory details about Java EE, the book assumes that the reader will look to focused books or tutorials for detailed information on Java EE. This allows the book to focus on administration and configuration of and deployment to JBoss AS 7.

Although examples in the book specifically use Eclipse, MySQL, and Windows, the descriptions and explanations are broad enough to cover other choices of IDE, database, and operating system respectively. The illustrations assuming one of these are relatively rare and most of the discussion is more general to JBoss AS 7 rather than to any of these supporting products. In many of these cases, alternatives (and how to use those alternatives) are mentioned. The final chapter (cloud computing with OpenShift) and the Appendix (common commands and operations) provide Linux-based examples.

There is a small number of typos and a few instances of questionable sentence structure, but the author's writing style generally flows easily and is easy to follow. There are numerous drawings, tables, and screen snapshots to illustrate points and highlight the more important details. I like the significant white space and the call outs for special notes and observations.

Chapter 1: Installing JBoss AS 7

Because I have not used JBoss for several years, I needed to install JBoss AS 7 and this chapter provides an easy guide to doing that. The chapter begins with brief coverage of the usefulness of Java EE application servers and of JBoss AS 7's high-level design. It then moves into the practical steps necessary for installing JBoss AS 7. The author recommends in one of the "important notes" that readers download and use the Java 6 SDK, but does acknowledge that Java SE 7 SDK is available and should work fine with JBoss AS 7. The chapter discusses installation on Windows and Linux/Unix and even includes a "tip/trick" highlighting of installation on Windows Vista. The chapter goes beyond basic installation (which amounts to uncompressing archive files) to discuss starting and stopping JBoss AS 7 and using Command Line Interface (CLI) to connect to it locally and remotely.

The initial chapter also discusses installation of Eclipse ("the development environment used in this book"). Besides downloading and installing Eclipse (Indigo), the chapter also discusses installation of the JBoss AS plugins (part of JBoss Tools) for Eclipse.

One of my favorite parts of this initial chapter is its coverage of the application server's directory structure and differentiation of JBoss AS 7's "standalone servers and domain servers." This was an important distinction for me coming back to JBoss after such a long period of time, but was an easy one to grasp because of my familiarity with GlassFish. After differentiating between the types of servers supported in JBoss AS 7, the section concludes with coverage of several significant directories/folders in the JBoss AS 7 installation.

Chapter 2: Configuring the Application Server

With JBoss AS 7 and tools (Eclipse) installed, it is natural to move onto configuring the JBoss AS 7 instance. This chapter had some surprises for me, including starting with this: "The application configuration has also been renewed, moving from a large set of XML files to a single monolithic file." The chapter discusses this single file and covers its default names (depending on server configuration). It goes through the configuration file one major section at a time, detailing how to configure the server in each area. There is quite a bit in this chapter on configuring logging. Another thing I learned here that has changed in JBoss in recent years is default use of its own logging framework.

Chapter 3: Configuring Enterprise Services

The third chapter is on configuring enterprise services. This chapter specifically focuses on configuring database connectivity, EJB container, messaging service, and transaction service.

The section of Chapter 3 on configuring database connectivity mentions that JBoss AS 7 comes with the H2 open source database server built in, but then uses MySQL for its examples. I liked how this chapter compared and contrasted how database configuration was performed in previous versions of JBoss AS to how it is now done in JBoss AS 7. The chapter demonstrates XML-based configuration of a data source (and how it was similar to that used in previous versions of the JBoss application server), but then also shows how to use the Java EE 6 annotation @DataSourceDefinition to programmatically configure the data source in conjunction with an EJB 3.1 Singleton EJB.

Chapter 3's section on configuring the EJB container starts by introducing the basics of EJBs with specific introductory focus on the "new EJB 3.1 variants introduced by Java EE 6": Singleton EJB, No-Interface EJB, and Asynchronous EJB. The chapter discusses in detail how to configure the different types of EJBs. It also points out the built-in JMS support in JBoss AS 7 provided by HornetQ. It also covers configuration related to JBoss AS 7's/HornetQ's use of Netty.

The section of Chapter 3 on configuring transactions introduces the Java Transaction API. It then explains how to configure the JTA support for timeouts and statistics gathering.

Chapter 4: JBoss Web Server Configuration

The focus of the fourth chapter of JBoss AS 7: Configuration, Deployment, and Administration is on configuration of the JBoss web server (JBoss Web), which is based on a fork of Tomcat 7. The chapter discusses HTTP connectors, including JBoss Web's built-in Coyote HTTP 1.1 connector and the Apache Portable Runtime (APR) connector. The chapter shows how to separately download and use the ARP connector with JBoss AS 7.

The chapter of JBoss Web server covers configuration of static (HTML/images) and dynamic (JSP) resources and then moves onto discussion of deploying JavaServer Faces (JSF)-based applications on JBoss AS 7. The author points out: "Currently, JBoss AS 7 supports the JSF release 2.1 using the Mojarra implementation, although there are plans for supporting MyFaces implementation too." The chapter then demonstrates using Eclipse to create a JSF project and adding an EJB layer to that application. The chapter also demonstrates adding JPA-based persistence (including how to switch the JPA provider from default Hibernate 4), setting a custom web context, and deploying the web application.

Chapter 5: Configuring a JBoss AS Domain

The fifth chapter concludes the chapters on configuration by providing a more detailed look at configuring JBoss AS 7 domains. Of particular interest to me is the sections on configuring the JVM and providing JVM options. I also found the author's use of VisualVM to be helpful. This detailed chapter introduces domain terminology, explains what a domain is, and explains why a domain does not provide the same functionality or purpose as node clustering. It provides thorough detail on configuring domains.

Chapter 6: Deploying Applications on JBoss AS 7

Deployment to JBoss AS 7 is the focus of Chapter 6. The chapter begins with an introduction to JAR, WAR, EAR, RAR, and SAR files and then goes onto more detailed (but still thankfully brief) coverage of the first three types of archive files.

After covering JAR, WAR, and EAR, the chapter moves onto coverage of manual and automatic deployments to JBoss AS 7. I was happy to see coverage of using CLI to deploy from the command line, but fans of deploying via web page will be happy to know that there is also coverage of deploying from the web administration console. The chapter also demonstrates deploying from the Eclipse IDE.

The most significant bane of my Java development experience has probably been classloaders, which become tricky when application servers, IDEs, and frameworks like Spring are involved. With this in mind, I was happy to see a section in the sixth chapter called "JBoss AS 7 classloading explained." Several pages are devoted to using JBoss's provided mechanism for appropriately dealing with classes used by the application server as well as the deployed applications. The chapter also talks about using Java EE's standard approach of specifying Class-Path in the MANIFEST.MF file.

Chapter 7: Managing the Application Server

The seventh chapter focuses on managing JBoss AS 7 via the command line-based CLI tool and the web-based Web admin console. Differentiation is made between CLI commands and CLI operations. I find the sections "Executing CLI scripts in batch" and "Executing scripts in a file" to be particularly interesting from a CLI perspective. The first section talks about CLI support for a group of commands as an atomic unit and the second section talks about writing file-based administration scripts. The book further peaks my interest in CLI by explaining how to take snapshots in CLI and how to display CLI history.

Although I find that I use command line-based tools for configuration, administration, and deployment of an application server in the long-run, web-based or other graphically-oriented tools are often nice when first using an application server or when trying to figure new things out. In other words, I prefer command line scripting for routine tasks and prefer graphically-oriented administrative tools for new or unusual tasks. The second half of Chapter 7 covers using "The new Web admin console."

Chapter 7's coverage of the history of JBoss's web administrative consoles is a good example of how the overall book does a nice job of comparing and contrasting different versions of JBoss tools. The chapter points out the advantages and limitations of the jmx-console approach (versions of JBoss up to JBoss 4.x) and the Seam-based Web admin console (JBoss 5.x and 6.x) before covering JBoss AS 7's GWT-based Web admin console. As one would expect, the section on Web admin console is filled with screen snapshots demonstrating the Web admin console in action.

Chapter 8: Clustering

One of the things many of us want from our application server is clustering functionality, which is the theme of Chapter 8 (load balancing of web applications is covered in the next chapter). The chapter points out several facets of clustering that have changed in JBoss AS 7. It also covers how JGroups and Infinispan are used to implement JBoss clustering. This is an information--packed chapter that I will be sure to read again before using JBoss AS 7 clustering.

Chapter 9: Load-balancing Web Applications

Chapter 9 covers load-balancing of web applications. The chapter only briefly covers installation of Tomcat's mod_jk and Apache's mod_proxy to connect the Apache web server to JBoss AS 7 because "the installation of either mod_jk or mod_proxy does not differ from earlier AS releases." The remainder of the chapter focused on load balancing covers mod_cluster (new to JBoss AS 7). The chapter concludes by returning to discussion of clustering. The author references the JBoss AS 7.1 High Availability Guide for continuing developments related to JBoss AS 7's clustering support.

Chapter 10: Securing JBoss AS 7

Chapter 10 of JBoss AS 7: Configuration, Deployment, and Administration is focused on security, an increasingly popular topic. Reading about security is often my best cure for insomnia, but there were some interesting nuggets in this chapter that kept my attention.

The chapter introduces PicketBox (formerly known as JBoss Security), the security framework upon which JBoss AS 7's security is built. It then provides a basic overview of Java's security API and provide definitions of key security terms in a Java EE context. This thorough chapter covers a wide range of security-related topics as they pertain to JBoss AS 7.

Chapter 11: Taking JBoss AS 7 in the Cloud

The final chapter is devoted to the trendiest topic of them all: cloud computing. The central focus of this chapter is Red Hat's OpenShift (PaaS). The author does as good a job as I have seen of describing cloud computing and I particularly liked the contrasting of cloud computing to grid computing. The majority of the chapter discusses starting with OpenShift Express and then transitioning to OpenShift Flex.

Appendix

The Appendix is six pages of "common commands and operations" that provides an easy access reference. Although the shown commands use Linux script jboss-admin.sh, the alternative for Windows (jboss-admin.bat) is shown at the beginning of the appendix. The subsections of the appendix are Startup Options, General Commands, Domain Mode, JMS, Data sources, mod_cluster, Batch, and Snapshots.

Conclusion

JBoss AS 7: Configuration, Deployment, and Administration delivers what it's title promises: an introduction and in-depth coverage of configuring and administrating and deploying to JBoss AS 7. Along the way, the book manages to provide differences in JBoss AS 7 from previous versions and to provide introductory details about aspects of Java EE supported in JBoss AS 7. This is not the book one would learn how to write JavaServer Pages, JavaServer Faces applications, EJBs, or other Java EE code from. However, it is the book one would learn how to deploy a Java EE application to JBoss AS 7 and how to maintain and configure JBoss AS 7 to most efficiently support Java EE applications.

Other Reviews

Other reviews of JBoss AS 7: Configuration, Deployment, and Administration are available. These include Markus Eisele's Review: "JBoss AS7 Configuration, Deployment and Administration" by Francesco Marchioni, Rick Wagner's Book Review for "JBoss AS 7 Configuration Deployment and Administration" (unfinished version of the book), Maksim Sorokin's [PACKT] JBoss AS 7 Configuration, Deployment and Administration (announcing review coming), and David Salter's Forthcoming Book Review (announcing review coming).