Chapter 09 : Application Deployment in Weblogic

To get into the practical session, lets first understand some basics of deployment process...


What is Application Deployment ?
ANS:
To understand deployment let's first understand what an application is. An Application is a set of instructions packaged together to perform some certain tasks.

For an application to be accessible and srve it's purpose it has to be deployed/installed on a server (managed server) or cluster.

And so, in a general term Application deployment can be considered as the process of making an application available for processing 
client requests in a WebLogic Server domain.

What can be deployed ?
ANS:
WebLogic Server supports the following types of deployment units:
  • Enterprise Application (.ear)
  • Web Application (.war)
  • Enterprise JavaBean (.jar)
  • Resource Adapter
  • Web Service
  • J2EE Library
  • Optional Package
  • JDBC, JMS, and WLDF Modules

  • Client Application Archive
For detailed explanation on all these deployment units, please click here.

What are the deployment tools ?
ANS:
Applications can be deployed using the below tools provided by weblogic server:


  • Administration Console ( Graphical User Interface )
  • weblogic.Deployer ( Command Line Interface )
  • WLST (Weblogic Scripting  Tool, Automation)


  • Deployment Tools for Developer ( wldeploy , weblogic-maven-plugin, weblogic.PlanGenerator )

Want  to learn more about these tolls ? Click Here


Where should we deploy the application ?
ANS:
Applications can be deployed on Admin server, managed server, virtual host or a cluster of managed servers.

It is advised to not deploy any user application on admin server as the onsole application is already deployyed on the AdminServer and has its own rsponsibilities.

What is staging mode ?
ANS:
The deployment staging mode determines how deployment files are made available to target servers that must deploy an application or standalone module.

Below table describes the three staging modes provided by Weblogic server:
[Courtesy: Oracle Docs]

Deployment Staging Mode
Behavior
When to Use
stage
The Administration Server first copies the deployment unit source files to the staging directories of target servers specified by the Staging Directory Name attribute.
The target servers then deploy using their local copy of the deployment files.
  • Deploying small or moderate-sized applications to multiple WebLogic Server instances.
  • Deploying small or moderate-sized applications to a cluster.
nostage
The Administration Server does not copy deployment unit files. Instead, all servers deploy using the same physical copy of the deployment files, which must be directly accessible by the Administration Server and target servers.
With nostage deployments of exploded archive directories, WebLogic Server automatically detects changes to a deployment's JSPs or Servlets and refreshes the deployment. (This behavior can be disabled if necessary.)
  • Deploying to a single-server domain.
  • Deploying to a cluster on a multi-homed machine.
  • Deploying very large applications to multiple targets or to a cluster where deployment files are available on a shared directory.
  • Deploying exploded archive directories that you want to periodically redeploy after changing content.
  • Deployments that require dynamic update of selected Deployment Descriptors via the Administration Console.
external_stage
The Administration Server does not copy deployment files. Instead, the Administrator must ensure that deployment files are distributed to the correct staging directory location before deployment (for example, by manually copying files prior to deployment).
With external_stage deployments, the Administration Server requires a copy of the deployment files for validation purposes. Copies of the deployment files that reside in target servers' staging directories are not validated before deployment.
  • Deployments where you want to manually control the distribution of deployment files to target servers.
  • Deploying to domains where third-party applications or scripts manage the copying of deployment files to the correct staging directories.
  • Deployments that do not require dynamic update of selected Deployment Descriptors via the Administration Console (not supported in external_stage mode).
  • Deployments that do not require partial redeployment of application components.



Most deployments use either stage or nostage modes, and the Administration Console automatically suggests the appropriate mode when you deploy an application or module.



Now, Lets undrstand How to deploy the application

METHOD-1 : Deploying application Using Weblogic console

Step-1: Launch the console URL
Step-2: Go to "Deployments" link under domain structure, below screen shows the same






Step 3: Click on "Lock and Edit" in the change center section of weblogic console URL





Step 4: Click on "'Install" button as shown in the screen below







Step 5: Now provide the application location in the Path

My application is stored under /u01 and hence navigated there






And  select the appication "benefits.war" and clock on "Next" button






Step 6: In the next screen choose "Install as an application" and click on "Next" button







Step 7: Now select the target, where you want to deploy the application, we will select the managed server "blrServer01" and click on "Next" button





Step 8: Use all the default selected options in the screen and click on "Finish" button. But just notice the highlighted points for understanding purpose





Step 9: Below screen appears




Step 10: Click on "Activate Changes", below screen appears






Step 11: Any newly deplyed application will be in "Prepared" state and cannot be accessible and hence to make it accessible you have to bring the application into "Active" state by following the navigation:

Depoyments --> Control tab -->Select the check box for the applicstion deployed --->Click on "Start" ---> select "servicing all requests"





Now the application should be in "Active" state as shown below:




Step 12: Validate the application functionality, navigate as below:

Deployments --> Select the application name (benefits) ---> Go to "Testing" Tab

below screen appears:





Step 13: select the URL above and launch the application





This completes the deployement process METHOD-1- using weblogic console.
Hope you enjoyed the session.

Now we shall see how to deploy application using weblogic.deployer utiity in the method 2.


METHOD-2: Deploying application Using weblogic.deployer utility

SYNTAX:
------------
java weblogic.Deployer -adminurl <console url> -username <wls admin username> -password <password> -deploy -name <application name> -targets <server/cluster name> -source <application location>


[oracle@workshop01 u01]$ cd /u01/Oracle/Middleware/user_projects/domains/myDomain/bin/

[oracle@workshop01 bin]$ . ./setDomainEnv.sh [oracle@workshop01 myDomain]$

[oracle@workshop01 myDomain]$ java weblogic.Deployer -adminurl t3://192.168.127.101:7001 -username weblogic -password welcome1 -deploy -name benefits -targets blrServer02 -source /u01/benefits.war
weblogic.Deployer invoked with options:  -adminurl t3://192.168.127.101:7001 -username weblogic -deploy -name benefits -targets blrServer02 -source /u01/benefits.war
<Jun 20, 2017 3:26:29 PM IST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, benefits [archive: /u01/benefits.war], to blrServer02 .>
Task 2 initiated: [Deployer:149026]deploy application benefits on blrServer02.
Task 2 deferred: [Deployer:149026]deploy application benefits on blrServer02.
Target state: deploy deferred on Server blrServer02
java.rmi.RemoteException: [Deployer:149145]Unable to contact 'blrServer02'. Deployment is deferred until 'blrServer02' becomes available.


NOTE: The managed server blrServer02 was down while deploying the application. and hence it is "deferred". Once the server will be started it should be fine and accessible.


Let's vaidate this by starting the managed server blrServer02, currently it is down:




Started the server blrServer02, let's validate the deployment and the application URL:




Yes, it is accesible:







This completes the deployment methods using weblogic console and weblogic.deployer utility.
You may explore more on this topic by using other methods like WLST and ant.

Now,As a learner there might be some generic doubts w.r.t deployment, I would try to answer them per my understanding. And if you have something specific, I would request you to post that in the blog, I will try to answer as soon a spossible.



How to delete a deployed application ?
ANS:

Step-1: Login to console


Step-2: Stop the deployment by doing :

Go to Deployments ---> Click on "Lock and Edit" in the change center ---> Select the deployment by clicking on the check box in front of the application/deployment name 
--->Click on "Stop" ---> Click on "Force Stop Now

Below screen appears:



---> Now Click on "Yes" on the next screen




Step-3: Go to Deployments --> click on "Lock and Edit" --> Select on check box before the deployment name -->Click on "Delete" button --> Click on "Yes" on the next screen --->Click on "Activate Changes" in the change center

Below screen appears:



NOTE:  If the deployment is not stopped, you will get below error on the screen:







Chapter 09 : Application Deployment in Weblogic

To get into the practical session, lets first understand some basics of deployment process... What is Application Deployment ? AN...