Once you create all your components , you may want to deploy them as a single logical unit called an enterprise application . Doing so will ease the deployment and help ensure that the environment of the staging server is the same or at least as close as possible to the one on the production server.
An enterprise application can be contained in single JAR file with the extension .ear, called an enterprise archive (EAR) file. The EAR file contains many JAR files, EJB JAR files, and WAR files called modules . Following is an example of a deployment descriptor for an EAR file:
<application> <display-name>Hello World Application</display-name> <description>Hello World Application.</description> <module> <web> <web-uri>hello.war</web-uri> <context-root>helloworld</context-root> </web> </module> <module> <ejb>greet-ejbs.jar</ejb> </module> </application>
This deployment descriptor would correspond to the following directory structure of an EAR file:
Enterprise Archive file root greet-ejbs.jar hello.war \---META-INF application.xml
This is based on a real example that is presented in chapter 6. To find out more about EAR files and EAR deployment descriptors, refer to the J2EE Specification chapters Application Assembly and Deployment.