HomeOracle J2EE Applications: Maintenance and Monitoring
J2EE Applications: Maintenance and Monitoring
In this final article of a six-part series, you will learn how to deploy, maintain, and monitor J2EE applications. You'll also review the content of all of the parts; a self-test is included at the end. It is excerpted from chapter eight of the Oracle 10g Application Server Exam Guide, written by Sam Alapati (McGraw-Hill; ISBN: 0072262710).
EJB modules depend on deployment descriptors to specify the runtime attributes of the enterprise beans. Deployment descriptors are saved in ejb-jar.xml files. EJBs are packaged and shipped along with their deployment descriptors (contained in the ejb-jar.xml file) in a standard format, in the form of a .jar (dot jar) file. When you deploy an EJB application, the deployment tool first reads the deployment descriptors specified in the ejb-jar.xml file. From this, the deployment tool gets information about the EJB, such as the type of beans packed in the .jar file, their transaction attributes, and their access permissions.
on the job: The ejb-jar.xml file specifies the run-time behavior of EJBs.
Using the Application Server Control to Deploy J2EE Applications
It is very easy to deploy J2EE applications through the Application Server Control. Here are the steps:
Go to the OC4J home page and click the Applications tab.
In the Deployed Applications section, click the Deploy EAR file.
The Deploy Application Wizard—Select Application page appears next. The Deploy Application Wizard will deploy the selected EAR file and apply any configuration changes you may make. Select the J2EE application you wish to deploy by providing the name and the location of the application’s EAR file. You must also select the parent application here. Click Continue.
The URL Mapping for Web Modules page is next. You map a Web module to a URL pattern on your Web site and click Next.
On the Resource References Mapping page, you do the following:
Select the JNDI location.
Select the data source.
Select the JNDI location.
For each CMP entity bean, select a data source location and the tables.
On the User Manager page, select the User Manager you want to use for security. The JAZN XML User Manager provides complete security; to do this, you must set up a default realm and the jazn-data.xml file. The XML User Manager requires you to additionally configure the principals.xml file. Click Next.
In the Security Role Mappings page, assign security roles to the users and groups that are part of the OC4J container.
In the Publish Web Services page, click the Publish button if you want to publish and Web services has defined your application. Click Next.
In the Summary page, review your selections and click Deploy.
Using dcmctl to Deploy EJBs
You can use the dcmctl deployApplication command, explained previously to show how to deploy Web application modules (WAR files), to deploy J2EE applications as well. Here’s an example:
$ dcmctl deployapplication -file /test/testEAR.ear -a testEAR -co OC4J_Test
The dcmctl deployApplication command is similar to the command you use to deploy Web applications, with the difference that you don’t have to specify the -rc option in the case of J2EE application deployment. If you use the -co (component name) option to specify a particular OC4J instance, the operation applies to only that OC4J instance within an OracleAS instance. In our example, the EAR module will be deployed to the OC4J instance named OC4J_Test. If you don’t specify the -co target option, the operation applies by default to the OC4J instance named home.
The following things happen when you execute the deployApplication command:
The WAR or EAR file is copied to the server.
The WAR or EAR Zip file is then expanded into runtime directories.
If necessary, the context root in the httpd.conf file and the mount points in the oc4j.conf file and server.xml are modified. A new mount point is added to the oc4j. conf file to match the root context.
All files are copied to the DCM repository.
Changes in Configuration Files
When you deploy applications, either by using the dcmctl utility or through the Application Server Control, several changes are made in the OC4J configuration. The following text gives a brief summary of the changes made in the main configuration files.
The application name is added to the server.xml file: