Of the three ways we can deploy an application to Oracle Application Server 10 g, the command line gives us the most flexibility. We can specify numerous parameters that affect how the application is deployed. While previous versions of the Oracle Application Server required you to copy files to the appropriate directories and manually edit the server.xml and http-web-site.xml files, the deployapplication switch of the dcmctl command in Oracle Application Server 10 g will move the files that make up your application to appropriate directories automatically. From the command line, issue the following command:
dcmctl deployapplication -file hockeyapp.ear -a hockeyapp -co OC4J_HockeyApp
In this example, the -file switch lists the file we wish to deploy, the -a switch sets the name of the application, and the -co switch lists the OC4J container we are deploying to.
Caution | It is important to note that the application name specified after the -a switch must exactly match the name of the WAR file. The root will be the virtual path where OC4J can reach your application. |
The dcmctl command is extremely powerful. There are too many options to explore in this chapter, but all options are listed in Table 15-2.
addopmnlink | applyarchiveto | applyclusterto | applyinstanceto |
configrepositoryssl | createarchive | createcluster | createcomponent |
deployapplication | destroyinstance | echo | exit |
exportarchive | exportrepository | getcomponenttype | geterror |
getopmnport | getrepositoryid | getreturnstatus | getstate |
help | importarchive | importrepository | isclusterable |
iscompatible | joincluster | joinfarm | leavecluster |
leavefarm | listapplications | listarchives | listclusters |
listcomponents | listcomponenttypes | listinstances | quit |
redeployapplication | removearchive | removecluster | removecomponent |
removeopmnlink | repositoryrelocated | resetdcmcacheport | resetfiletransaction |
resethostinformation | restart | restoreinstance | resyncinstance |
saveinstance | set | setloglevel | shell |
shutdown | start | stop | undeployapplication |
updateconfig | validateearfile | whichcluster | whichfarm |
whichinstance |
Caution | It is important to note that while the dcmctl command is extremely powerful, it also has the ability to misconfigure your application server if not used properly, making it unusable. The safest bet for interaction with Oracle Application Server 10g is by way of the Enterprise Manager Application Server Control web pages. The dcmctl command is a great, stable tool for deploying applications and modifying OC4J containers, but it should be used by experienced developers only. Accordingly, it is the authors recommendation to use method 2 (Via the Oracle Enterprise Manager Application Server Control Web Site) or 3 (Via Oracle JDeveloper 10g) unless there is an explicit reason to do otherwise . Methods 2 and 3 are discussed later in this chapter. |
Further information about any of the options can be printed out with this syntax:
dcmctl -help <command>
The following is an example of the dcmctl help system:
C:\AS_HOME\dcm\bin>dcmctl -help applyinstanceto applyInstanceTo Applies the configuration of the named instance to another instance or cluster. Type Configuration Management Syntax applyInstanceTo -src instanceName [-cl clusterName -i instanceName] Description The configuration of the named instance is applied to the named instance or cluster. If no instance or cluster is specified, then the configuration of the named instance is applied to the current instance. The named source instance is not affected. The command will fail if the current instance and the named instance are the same (you cannot apply the configuration of an instance to itself). Example dcmctl applyinstanceto -src instance1