HomeOracle Page 3 - Managing OC4J and Configuring J2EE Applications
Deploying EJBs - Oracle
This article will help you get a better grasp of how Oracle Application Server 10g supports Java 2EE applications. It is excerpted from chapter eight of the book Oracle 10g Application Server Exam Guide, written by Sam Alapati (McGraw-Hill; ISBN: 0072262710).
You deploy EJBs as well as all the other components of your J2EE application by packaging together all the necessary modules for an application. You put all relevant components into a zipped file, ending with a specific extension denoting the type of file; the Java Virtual Machine will then execute that single file. J2EE applications can have three types of application deployment files, also called archives: JAR files, WAR files, and EAR files.
JAR Files JAR (Java Archive) files can represent an applicationís EJB application module as well as a client application. The EJB JAR files, which include the Enterprise JavaBeans (EJBs) along with the JSP files, images, and the like are packaged together into one file archive, named a JAR, thatís executed by the Java Virtual Machine as one. JAR files have the extension .jar.
WAR Files A WAR (Web Application Archive) file is used to package Web application module components such as HTML pages, servlets, and JSP pages. Typically, a WAR file contains an XML file named web.xml, which serves to describe the various Web components inside the WAR file.
EAR Files You use an EAR (Enterprise Archive) file to package an entire enterprise Java application, including both the Java and the Web components, for deployment to OC4J. Therefore, an EAR file can contain both JAR and WAR files. The application.xml XML file included in an EAR file describes the contents of the EAR file.
Java provides a utility to zip the deployment files, in order to create the three types of archives. You can use the jar utility to create a JAR and a WAR file, as shown here:
$ jar -cvfM <application-name>.ear $ jar -cvfM <application-name>.war