Oracle® Application Server Containers for J2EE Enterprise JavaBeans Developer's Guide
10g Release 2 (10.1.2) Part No. B15505-01 |
|
![]() Previous |
![]() Next |
To prepare the application for deployment, you do the following:
Modify the application.xml
file with the modules of the enterprise Java application.
Archive all elements of the application into an EAR file.
These steps are described in the following sections:
The application.xml
file acts as the manifest file for the application and contains a list of the modules that are included within your enterprise application. You use each <module>
element defined in the application.xml
file to designate what comprises your enterprise application. Each module describes one of three things: EJB JAR, Web WAR, or any client files. Respectively, designate the <ejb>
, <web>
, and <java>
elements in separate <module>
elements.
The <ejb>
element specifies the EJB JAR filename.
The <web>
element specifies the Web WAR filename in the <web-uri>
element, and its context in the <context>
element.
The <java>
element specifies the client JAR filename, if any.
As Figure 10-2 shows, the application.xml
file is located under a META-INF
directory under the parent directory for the application. The JAR, WAR, and client JAR files should be contained within this directory. Because of this proximity, the application.xml
file refers to the JAR and WAR files only by name and relative path—not by full directory path. If these files were located in subdirectories under the parent directory, then these subdirectories must be specified in addition to the filename.
For example, the following example modifies the <ejb>
, <web>
, and <java>
module elements within application.xml
for the Hello EJB application that also contains a servlet that interacts with the EJB.
<?xml version="1.0"?> <!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN" "http://java.sun.com/j2ee/dtds/application_1_2.dtd"> <application> <display-name>helloworld j2ee application</display-name> <description> A sample J2EE application that uses a Helloworld Session Bean on the server and calls from java/servlet/JSP clients. </description> <module> <ejb>helloworld-ejb.jar</ejb> </module> <module> <web> <web-uri>helloworld-web.war</web-uri> <context-root>/helloworld</context-root> </web> </module> <module> <java>helloworld-client.jar</java> </module> </application>
Create the EAR file that contains the JAR, WAR, and XML files for the application. Note that the application.xml
file serves as the EAR manifest file.
To create the helloworld.ear
file, execute the following in the hello
directory contained in Figure 10-2:
% jar cvf helloworld.ear .
This step archives the application.xml
, the helloworld-ejb.jar
, the helloworld-web.war
, and the helloworld-client.jar
files into the helloworld.ear
file.