In this week's part of a multi-part series covering OC4J and J2EE applications, you will learn how to deploy J2EE applications, create data sources, and more. This article is excerpted from chapter eight of the Oracle 10g Application Server Exam Guide, written by Sam Alapati (McGraw-Hill; ISBN: 0072262710).
You can use either the Application Server or the dcmctl utility to deploy Web applications. In the following subsections, examples are given of both approaches to Web application deployment.
Using the dcmctl Utility
Using the dcmctl utility, you can deploy, undeploy, and redeploy Web applications by using the supplied WAR files. Hereís an example showing how to use dcmctl to deploy a WAR file:
dcmctl deployapplication -file /test/testapp.war -a testapp \ -co home -rc /myiAS/myWebapps
In the preceding dcmctl command, the various options stand for the following:
file refers to the WAR file (it could also be an EAR file) that you want to deploy.
a refers to the name of the application being deployed (testapp in our example).
-co (component name) specifies the OC4J instance to which this WAR file will be deployed. If you leave this parameter out, the application will, by default, be deployed to the home OC4J instance.
The -rc option specifies the base path a URL will use to access the Web module (for example, http:// hostname:port/context_root) you are deploying. Note that the -rc option applies only when youíre deploying WAR files.
Note that you mustnít use the -rc option when deploying EAR files.
To redeploy a Web application, use the dcmctl command as in the foregoing example, but with the redeployApplication option instead of the deployApplication option. To undeploy an application, use the undeployApplication option.
Using the Application Server Control
You deploy WAR files in order to deploy Web applications. However, when you deploy a WAR file for the first time, the Application Server Control wraps the application in an EAR file, thus making it a J2EE application. Use the following steps to deploy a Web application through the Application Server Controlís Deploy Web Application page, which displays a list of all OC4J applications deployed on the OC4J server:
Go to the OC4J home page and click the Applications tab.
In the OC4J server Applications page, click the Deploy WAR file, under the Deployed Applications section.
In the Deploy Web Applications page, supply the path to the Web application, the Web applicationís name, and the URL it should be mapped to. Figure 8-7 shows the Deploy Web Application page.
Figure 8-7.The Deploy Web Application Page
Click the Deploy button to deploy the Web application.
Note that once you deploy a Web application file through the Application Server Control, you canít redeploy it by using the EAR file created for it by the Application Server Control. You must first undeploy the application and then deploy the WAR file again.
Please check back next week for the conclusion to this article.