Under J2EE, applications and components reside in Java Archive (JAR) files. These JARs are named with different extensions to denote their purpose, and the terminology is important.
-
Enterprise Archive (EAR) files represent the application, and contain all other server-side resources, components and archives that comprise the application.
-
Client interface files and EJB components reside in JAR files.
-
Web components reside in Web Archive (WAR) files.
Deployment descriptors are included in the JARs, along with component-related resources. Deployment descriptors are XML documents that describe configuration and other deployment settings. Remember that the J2EE application server controls many functional aspects of the services it provides. The statements in the deployment descriptor are declarative instructions to the J2EE container; for example, transactional settings are defined in the deployment descriptor and implemented by the J2EE container. Most J2EE vendors provide a GUI tool for generating deployment descriptors and performing deployment because creating manual entries is tedious and error prone. The J2EE RI includes deploytool, which is the deployment vehicle we'll use in this tutorial.
The deployment descriptor for an Enterprise JavaBean must be named ejb-jar.xml, and it resides in the META-INF directory inside the EJB JAR file. A JAR can contain multiple beans; if so, a single ejb-jar.xml file describes all beans in the JAR. For more information concerning packaging and deployment, see Appendix B: Deployment.