Chapter 14. EJB and JBoss

Once you move into the world of web applications, you'll find tasks that aren't well suited for servlets and especially for JSPs. In particular, the most complicated business processes in enterprise Java are not easily coded up in a JavaServer Page. Dealing with complicated financial transactions, for example, isn't something that fits well into a page of mostly HTML, or even into a servlet that is geared toward a request/response model. Instead, you need technology that provides security, transactions, and a strong server-side component model.

Enterprise JavaBeans ( EJB) refers to a specification that builds these types of server-side components. These components are installed into a J2EE application server. By writing Java components that conform to this specification, you take advantage of the application server's sophisticated functionality as well as a known set of interfaces.

The specific functionality offered by a particular J2EE application server varies, but generally the use of EJB features prominently in J2EE applications. In the last chapter, you saw a simpler form of a web application based on JSP pages, servlets, and often a database and some helper classes. J2EE applications are a bit more complex, often having three, four, or more application tiers and involving five, six, or even ten different Java APIs. In these more complex cases, you need a J2EE application server instead of (or in addition to) a simple web container like Tomcat.

This chapter shows you how to install JBoss, a popular open source J2EE application server. Like Tomcat, JBoss runs smoothly on Mac OS X and offers enterprise-level services for Apple's newest platform. It also examines some basic examples that come with JBoss to give you a feel for how EJBs function on Mac OS X. Like the last chapter, EJB aficionados can skim the chapter looking for Mac OS X specifics, while newbies can learn enough about EJB to get started in J2EE development.

It's far beyond the scope of this text to describe EJB application development, design, and architecture. Instead, this chapter will help you get JBoss installed and a sample application installed and working. For a more thorough investigation of EJB, consult O'Reilly's Enterprise JavaBeans by Richard Monson-Haefel.