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:
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
Create two directories:
[wls@prod01]$ mkdir app [wls@prod01]$ mkdir plan
Copy the
myApp.ear
file to theapp
directory.Access the Administration Console with your web browser at
http://prod01.domain.local:7001/console
.Click on the Lock & Edit button to start a new edit session.
Navigate to the Deployments page by clicking on the link in the domain structure.
Click on the Install button to install a new application.
Type the path
/oracle/applications/prod/myApp/v1/app
and click on Next.Select
myApp.ear
from the list and click on Next.Select Install this deployment as an application and click on Next.
Select the All servers from the cluster radio button from the
PROD_Cluster
cluster and click on Next.Leave the default options and click on the Finish button.
A new deployment plan file will automatically be created in
/oracle/applications/prod/myApp/v1/plan/Plan.xml
.Click on the Activate Changes button to apply the changes.
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:
Go to the WebLogic domain's
bin
directory:[wls@prod01]$ cd $DOMAIN_HOME/bin
Set the environment variables:
[wls@prod01]$ . ./setDomainEnv.sh
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
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 .>
The
myApp
application should be deployed to thePROD_Cluster
cluster.
Deploying applications using WLST
Now let's deploy the application through WLST using the following steps:
Log in as a
wls
user to shell and start WLST:[wls@prod01]$ $WL_HOME/common/bin/wlst.sh
Connect to the Administration Server using
wlsadmin
as the user,<pwd>
as the password, andt3://prod01.domain.local:7001
as the server URL:wls:/offline>connect("wlsadmin","<pwd>","t3://prod01.domain.local:7001")
Run the following WLST command to deploy the
myApp.ear
application to thePROD_Cluster
cluster:deploy("myApp", "/oracle/applications/prod/myApp/v1/app/myApp.ear","PROD_Cluster")
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