Deploying and Undeploying Applications Manually

The ASC utility is easy to use, but sometimes it's more practical to deploy applications via the dcmctl command-line tools. Cases like this include when you don't or cannot start the webbased ASC utility, or if you want to have deployments and redeployments scripted so administrators with less training can deploy applications. Scripting these processes also improves the repeatability and consistency, which is important in test and validation and production environments.

Deployment Steps

The following are the steps for a manual deployment.

  1. When deploying with the ASC, the EAR file was located on the PC workstation where it's accessed and copied by the ASC. For a manual deployment, you need to send the EAR file via binary FTP to the mid tier , as follows :

     $ pwd /home/oracle/deployments/ftp_dir $ ls -l total 460 -rw-r--r--    1 oracle   dba        465435 Feb 21 16:48 ojspdemos.ear $ 
  2. Determine which OC4J instance to use for the deployment.

     $ dcmctl getstate Current State for Instance:904mt1.mike.wessler.name     Component               Type          Up Status     In Sync Status ====================================================================== 1   home                    OC4J          Up            True 2   HTTP_Server             HTTP_Server   Up            True 3   webdev                  OC4J          Up            True $ 

    Just as you did with the ASC deployment, you'll want to use the webdev instance. You can do a deployment rather than a redeployment because you undeployed the application at the end of the ASC section.

  3. Perform the deployment. This will use the same defaults as you did with the ASC tool, as shown here:

     $ dcmctl deployapplication -file ./ojspdemos.ear -co webdev -application ojspdemos 

The arguments for deployapplication are as follows:

  • -f . Location and name of the EAR file that was located in the current working directory ./ojspdemos.ear .

  • -co . The OC4J component to deploy to; in this case, use webdev . If the co flag isn't spec-ified, the application is deployed to every OC4J instance in the mid-tier .

  • -application . The name of the application to be deployed, which is ojspdemos .

The application is now deployed and can be accessed just as before because the URL mappings were taken from within the same EAR files. The URL would be http://mike.wessler.name:7777/ojspdemos/ .

Additionally, the ASC Deployed Application page would reflect this new deployment.

Redeployment Steps

As application code changes, it's necessary to redeploy EAR files to the mid tier so that the changes take effect. Rather than undeploying and then deploying the application, it's easier just to redeploy the application.

The arguments for redeployapplication are the same as deployapplication , as shown here:

 $ dcmctl redeployapplication -file ./ojspdemos.ear -co webdev -application ojspdemos 

This command can easily be scripted to allow for applications to be redeployed rapidly , even by people who aren't skilled with dcmctl .

Undeployment Steps

Deployment of the application via the command line is simple with the dcmctl command undeployapplication . To undeploy an application, enter the following:

 $ dcmctl undeployapplication -co webdev -application ojspdemos 

Previously, we specified the application to remove and which OC4J instance it belongs to because an application could be deployed to multiple instances. After the command completes, the application has been removed.

Caution 

Deploying and undeploying applications is easy, however under the OC4J 9.0.3 Standalone Edition and 9iAS 9.0.2 release there sometimes were problems with "routine" deployments. Periodically, the deployment would fail and the OC4J instance would become corrupted and unusable. We never determined the exact cause, although we suspected corrupted EAR files (possible FTP problems). The result was an OC4J instance that could not run any applications deployed to it. Redeploying the EAR and bouncing OC4J didn't help. The normal solution for standalone OC4J containers was to recover from tape backup or simply reinstall and deploy the applications. Resyncing the instance from the repository didn't seem to help for 9iAS instances either; those had to be restored from tape. We have not seen this yet with 10g AS (9.0.4), and problems were very rare, but it's something you should be aware of.

In this section, you learned how prepackaged EAR file applications are deployed, redeployed, and removed by the dcmctl utility. This utility is inherently faster than navigating the user -friendly ASC utility, and it makes sense to script the redeployment steps in most environments. It's also less error prone and more consistent for test and production deployments.



Oracle Application Server 10g. J2EE Deployment and Administration
Oracle Application Server 10g: J2EE Deployment and Administration
ISBN: 1590592352
EAN: 2147483647
Year: 2004
Pages: 150

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net