Redeploying the MedRec Package
This tutorial shows how to use the Administration Console to redeploy the MedRec application to MedRecServer in a production environment. The MedRec applications are contained in the dist directory, packaged in three directories in the recommended exploded format.
Redeploy an application if you have updated its class files or its generated deployment descriptor files.
The tutorial includes the following sections:
Before starting this tutorial:
- Work through Tutorial 13: Packaging MedRec for Distribution.
- Work through Tutorial 14: Deploying the MedRec Package for Production, and have the package currently deployed to MedRecServer.
This demonstration includes three separate procedures:
- Procedure 1: Edit a deployment descriptor without redeploying.
- Procedure 2: Refresh a static file without redeploying the application.
- Procedure 3: Redeploy the entire application.
Procedure 1: Edit a deployment descriptor without redeploying.
Use the Administration Console to modify certain deployment descriptor elements and their attributes for Applications that are deployed as exploded archive files. You cannot edit these descriptors for applications packaged as EARs.
In this procedure, change the value that determines the number of seconds a Web Application remains idle before timing out.
- Open the Administration Console.
Browse to http://localhost:7101/console, where localhost is the network name of your computer.
- In the left pane of the Console, expand Deployment and select Applications.
The Applications table displays all deployed applications, which include the medrecEar, physicianEar, and startupEar applications you deployed in Tutorial 15: Deploying the MedRec Package for Production.
- In the right panel, expand medrecEAR and select patient to select the patient Web Application.
- In the right pane, select Configuration->Descriptor.
The descriptor elements displayed in the Descriptor tab are limited to descriptor elements that can be dynamically changed at runtime.
- Scroll down to the Deployment Descriptors box and click weblogic.xml to open it in a separate window.
- Locate the session-descriptor element, which should look like this stanza:
<session-descriptor><session-param><param-name>TimeoutSecs</param-name><param-value>600</param-value></session-param>- Return to the WebLogic Server Administration Console and edit the TimeoutSecs parameter by adding a "1" before the "600."
- Click Apply.
- Return to the weblogic.xml page and refresh your browser to see the updated param-value, which is now in effect for the application.
Procedure 2: Refresh a static file without redeploying the application.
Use the weblogic.Deployer utility to notify the server when static files have changed.
In this procedure, you change an image, refresh the image file on the server, and view the refreshed file in the Web Application. Clean up the application by restoring the image and refreshing the file again.
Use the file logo.gif in the physicianWebApp component of physicianEar. The Web Application references this file from a virtual directory specified in the weblogic.xml file located in the WEB-INF directory (not from the Web Application images directory).
The relevant stanza from weblogic.xml follows:
<virtual-directory-mapping>
<local-path>C:/bea/weblogic81sp1/weblogic81/samples/server/medrec/src/common/web</local-path>
<url-pattern>images/*</url-pattern>
</virtual-directory-mapping>
- Save logo.gif to an alternate name such as logo1.gif.
- Save a different GIF file to logo.gif.
- Open a command window and set your environment
WL_HOME\samples\domains\medrec> setMedRecEnv.cmdChange to the application directory, WL_HOME\samples\server\medrec\dist\physicianEar.
- Enter the redeploy command, specifying logo.gif.
java weblogic.Deployer -adminurl http://localhost:7101 -user weblogic -password weblogic -name physicianEar -redeploy ..\..\src\common\web\images\logo.gif
The server reports on the task:
Initiated Task: [11] [Deployer:149026]Redeploy application physicianEar on MedRecServer.Task 11 completed: [Deployer:149026]Redeploy application physicianEar on MedRecServer.Deployment completed on Server MedRecServer
- Rename logo1.gif to logo.gif.
- Repeat the redeploy command:
java weblogic.Deployer -adminurl http://localhost:7101 -user weblogic -password weblogic -name physicianEar -redeploy ..\..\src\common\web\images\logo.gifProcedure 3: Redeploy the entire application.
In this procedure it is assumed that MedRec is deployed to a currently running instance of MedRecServer. Follow these steps to update a deployed application whose class files or generated deployment descriptor files have been changed.
- Open the Administration Console.
Browse to http://localhost:7101/console, where localhost is the network name of your computer.
- In the left pane of the Console, expand Deployments and select Applications.
The Applications table displays all deployed applications, which include the medrecEAR, physicianEAR, and startupEAR applications you deployed in Tutorial 15: Deploying the MedRec Package for Production.
- Redeploy all three applications, starting with medrecEAR.
- Click on medrecEAR.
In the right-hand panel, the medrecEAR Configuration tab displays configuration details.
- Select the Deploy tab.
The Deploy panel lists deployment status of EJB modules and Web Application modules.
- Click Redeploy Application.
- Return to the Deploy->Applications panel, select medrecEAR, and repeat steps b and c.
- Return to the Deploy->Applications panel, select startupEAR, and repeat steps b and c.
Redeploying an application in production is a serious undertaking that can affect performance, so plan application updates carefully. Redeploying an application re-sends the entire application over the network to all of the servers targeted by that Web Application. Increased network traffic may affect network performance when an application is re-sent to the Managed Servers. If the application is currently in production and in use, redeploying causes WebLogic Server to lose all active HTTP sessions.
If you have only modified static files, it is probably possible to refresh the files without redeploying the entire application. See Redeploying Static Files in a Web Application in Deploying WebLogic Server Applications.
Some deployment descriptor elements can be modified without redeploying the application. See Viewing and Updating Deployment Descriptors in the Administration Console Online Help.
This tutorial explains how to redeploy an application in production using the Administration Console. You can also use the command-line weblogic.Deploy tool to redeploy applications, and to refresh static files in a deployed application.
If you have added modules in your application, redeploying the application deploys the current modules. If you have deleted modules from your application, explicitly remove them from the application domain to remove them from deployment. See Removing an Application or Module from the Domain in Deploying Applications and Modules.
Related Reading