Chapter 2: J2EE Deployment Concepts


Overview

This chapter is an overview of several key concepts for assembling and deploying J2EE applications. In Chapter 6, "Building J2EE Applications with Ant," we use Ant to create Java ARchive (JAR) files, Web ARchive (WAR) files, and Enterprise JavaBean (EJB) JARs, so you will need to have a background in the various deployment descriptors for these modules. If you already have considerable experience with J2EE applications, you may want to skip to Chapter 3, Storing and Managing Code with CVS.

The J2EE platform provides component models for assembling applications. J2EE lets you divide and conquer an application by buying and building components and wiring them together into an application. Java and J2EE support the following components :

  • Client Components

    • JavaBeans

    • Applets

  • Web Application Components

    • Servlets

    • JSPs

    • TagLibs

  • Enterprise JavaBeans

    • Session beans

    • Stateless session beans

    • Entity beans

Each component executes in a container. To interoperate with various containers, these components require deployment descriptor files, configuration files, property files, and/or metadata files, and other configuration files. All these files describe the components and how they will interact with other components and their container environment.

Deployment can be a complex matter. A typical deployment might involve creating an Enterprise ARchive (EAR) file that can contain JAR and WAR files. The JAR files can in turn contain enterprise beans. The WAR file can in turn contain Web components (servlets, TagLibs, JavaBeans, and JSP), HTML pages, images, Java class files, and other JAR files that contain application components (JavaBeans, client-side remote references to enterprise beans and applets). The deployment descriptor for a Web application (which we will cover later) may contain env-entry elements that are mapped to the Java Naming and Directory Interface (JNDI) names java:comp/env (the context), ejb-ref (describes enterprise beans), and resources-ref (maps Java Messaging Service, Java Database Connectivity, and mail resources so that the Web application can use them).

The next two figures show the block diagrams of the two J2EE applications that we build, test, and deploy throughout this book (see Appendix A, Example Applications Used in This Book for details on these applications). The first figure shows our HelloWorld application, and the second shows the pet store application. As you can see, several different types of components need to be deployed to multiple servers and containers.

click to expand
click to expand

To say that configuration management of a typical J2EE enterprise application is complex is an understatement. In chapters 5 and 6 we will use Ant to help facilitate this process. Otherwise, continuous integration would be pretty tough with the complexities of the J2EE deployment environment.

The remainder of this chapter describes the basic J2EE components and how they are deployed. We also explain the JAR file format, because many components and sets of components are packaged in either a JAR file or some variation of a JAR file.




Professional Java Tools for Extreme Programming
Professional Java Tools for Extreme Programming: Ant, XDoclet, JUnit, Cactus, and Maven (Programmer to Programmer)
ISBN: 0764556177
EAN: 2147483647
Year: 2003
Pages: 228

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net