官术网_书友最值得收藏!

Deploying applications

This recipe will cover the deployment of a J2EE Application archived file (EAR), but it also applies to Web Application (WAR), Resource Adapters(RAR), and other JAR archived files, such as libraries, EJBs, and Java classes.

The following steps will walk you through the process to deploy the application. The WebLogic administrator usually assumes the deployer role in a production environment, so make sure to define a well-structured procedure to deploy the applications and follow it.

Getting ready

This recipe will deploy an archived application file called myApp.ear. The application will be target of the PROD_Cluster cluster instead of the individual Managed Servers.

How to do it...

Carry out the following steps:

  1. Create a new directory to be the application installation directory using the syntax/oracle/applications/<environment>/<application>/<version>:
    [wls@prod01]$ mkdir -p /oracle/applications/prod/myApp/v1
    [wls@prod01]$ cd /oracle/applications/prod/myApp/v1
    
  2. Create two directories:
    [wls@prod01]$ mkdir app
    [wls@prod01]$ mkdir plan
    
  3. Copy the myApp.ear file to the app directory.
  4. Access the Administration Console with your web browser at http://prod01.domain.local:7001/console.
  5. Click on the Lock & Edit button to start a new edit session.
  6. Navigate to the Deployments page by clicking on the link in the domain structure.
  7. Click on the Install button to install a new application.
  8. Type the path /oracle/applications/prod/myApp/v1/app and click on Next.
  9. Select myApp.ear from the list and click on Next.
  10. Select Install this deployment as an application and click on Next.
  11. Select the All servers from the cluster radio button from the PROD_Cluster cluster and click on Next.
  12. Leave the default options and click on the Finish button.
  13. A new deployment plan file will automatically be created in /oracle/applications/prod/myApp/v1/plan/Plan.xml.
  14. Click on the Activate Changes button to apply the changes.
  15. The application should be in a Prepared state. Start the application by selecting the myApp checkbox and clicking on the Start button with the Servicing all requests option.

How it works...

This procedure installs a simple enterprise application named myApp to the cluster PROD_Cluster in the WebLogic domain.

The application is distributed to the cluster using the default deployment option stage mode. In the stage mode deployment, the Administration Server prepares the myApp.ear file to be copied to the stages directory of each of the Managed Servers of the cluster PROD_Cluster. The directory is $DOMAIN_HOME/servers/<servername>/stage/<application>.

WebLogic will use this local copy until a new redeployment is made.

There's more...

There are many options to achieve the same results when deploying.

Deploying using the weblogic.Deployer tool

You can use the command-line tool weblogic.Deployer to make deployment changes in a WebLogic domain.

To perform the same deployment of myApp.ear to the PROD_Cluster cluster, do the following:

  1. Go to the WebLogic domain's bin directory:
    [wls@prod01]$ cd $DOMAIN_HOME/bin
    
  2. Set the environment variables:
    [wls@prod01]$ . ./setDomainEnv.sh
    
  3. Run the weblogic.Deployer command line with the parameters:
    [wls@prod01]$ java weblogic.Deployer -adminurl t3://prod01.domain.local:7001 -username wlsadmin -password <pwd> -deploy -targets PROD_Cluster /oracle/applications/prod/myApp/v1/app/myApp.ear
    
  4. The following should be the output:
    weblogic.Deployer invoked with options: -adminurl t3://prod01.domain.local:7001 -username wlsadmin -deploy -targets PROD_Cluster /oracle/applications/prod/myApp/v1/app/myApp.ear
    <Info><J2EE Deployment SPI><BEA-260121><Initiating deploy operation for application, myApp [archive: /oracle/applications/prod/myApp/v1/app/myApp.ear], to PROD_Cluster .>
    
  5. The myApp application should be deployed to the PROD_Cluster cluster.
Deploying applications using WLST

Now let's deploy the application through WLST using the following steps:

  1. Log in as a wls user to shell and start WLST:
    [wls@prod01]$ $WL_HOME/common/bin/wlst.sh
    
  2. Connect to the Administration Server using wlsadmin as the user, <pwd> as the password, and t3://prod01.domain.local:7001 as the server URL:
    wls:/offline>connect("wlsadmin","<pwd>","t3://prod01.domain.local:7001")
    
  3. Run the following WLST command to deploy the myApp.ear application to the PROD_Cluster cluster:
    deploy("myApp", "/oracle/applications/prod/myApp/v1/app/myApp.ear","PROD_Cluster")
    
  4. The following should be the output:
    Deploying application from /oracle/applications/prod/myApp/v1/app/myApp.ear to targets PROD_Cluster (upload=false) ...
    <Apr 6, 2013 11:02:24 PM BRT><Info><J2EE Deployment SPI><BEA-260121><Initiating deploy operation for application, myApp [archive: /oracle/applications/prod/myApp/v1/app/myApp.ear], to PROD_Cluster .>
    .Completed the deployment of Application with status completed
    Current Status of your Deployment:
    Deployment command type: deploy
    Deployment State : completed
    
主站蜘蛛池模板: 梁山县| 崇左市| 芜湖市| 乐都县| 枣强县| 凤庆县| 丰顺县| 孙吴县| 习水县| 通化县| 沙雅县| 丰县| 大关县| 镇远县| 宜兴市| 白水县| 黑山县| 汤阴县| 内黄县| 重庆市| 凯里市| 仪陇县| 宁南县| 黎平县| 奉贤区| 西城区| 财经| 永德县| 涪陵区| 寻乌县| 突泉县| 融水| 高州市| 昌黎县| 仙桃市| 临江市| 石首市| 突泉县| 巴中市| 临澧县| 桐乡市|