Moving to Production Mode

Tutorial 15: Deploying the MedRec Package for Production

This tutorial describes how to use the Administration Console to deploy the MedRec application to a server for production. In this example the application files are packaged in exploded format in directories, rather than as EAR files. The advantage of the exploded format for production is that deployment descriptor files in an exploded directory can be updated without having to be unarchived and then rearchived following the update.

For instructions on packaging the MedRec application into a single archived EAR file, in contrast to the exploded format used in this tutorial, see Tutorial 14: Packaging MedRec for Distribution. The advantage of packaging into an EAR file is that the application is more portable when bundled into a single file, and can more easily be moved or distributed.

The procedures below deploy the exploded contents of the medrecEar, startupEar, and physicianEar subdirectories of the dist directory, created in Tutorial 13: Compiling the Entire MedRec Project.

- medrecEar is MedRec's main enterprise application, containing its patient and administrative Web Applications, the Web service used by the physician Web application, and the EJBs that store and run MedRec's logic and data.
- physicianEar is a separate component of the MedRec application, with a different set of users, which communicates with medrecEar using a Web Service.
- startupEar contains a single class file that starts the browser when the servlets in the Web Applications are initialized.

For more information about the components of the MedRec application, see Overview of the Avitek Medical Records Development Tutorials.

The tutorial includes the following sections:

- Prerequisites
- Procedure
- Best Practices
- Related Reading

Prerequisites

Before starting this tutorial:

- Create the MedRec domain and the MedRec server. See Tutorial 1: Creating a WebLogic Domain and Server Instance for Development.
- Work through Tutorial 2: Starting the PointBase Development Database.
- Work through Tutorial 3: Setting Up WebLogic Server Resources for the MedRec Server.
- Create the MedRec project directory. See Tutorial 5: Creating the MedRec Project Directory.
- Familiarize yourself with how MedRec's split directory structure works, in Tutorial 7: Compiling Applications Using the Split Development Directory.
- Most importantly, work through Tutorial 13: Compiling the Entire MedRec Project, because the directories that contain the MedRec application in exploded format are created in its steps.

Procedure

1. Start the MedRec server, if it is not already running.

   From the Windows start menu:

   Start->Programs->BEA WebLogic Platform 8.1->User Projects->MedRecDomain->Start Server

   From the command line:

   >     C:\bea\user_projects\domains\MedRecDomain>startWebLogic.cmd

2. Open the Administration Console.

   Once the server starts, open http://localhost:7101/console in a browser, where localhost is the network name of your computer.

3. Undeploy applications from previous tutorials:

   1. Expand Deployments in the left pane of the Console and click the Applications folder. The right pane of the Console may show existing deployments from the previous tutorials (medrec_deployment and wlpackage_tutorial).

   2. Click the trash can icon to the right of an existing deployment. The Console prompts you to undeploy the application.

   3. Click Yes to remove the deployment, then click Continue.

   4. Repeat the above steps for any other MedRec deployments on the server.

4. Deploy the MedRec applications to MedRecServer:

   1. Expand Deployments in the left pane of the Console.

   2. Right-click Applications and select Deploy a New Application.

   This initiates the Enterprise Application Deployment Assistant in the right panel.

   3. Use the links in the Location field to navigate to C:\medrec_tutorial\dist.

   The Deploy an Application page table contains three applications that were created in Tutorial 12: medrecEar, physicianEar, and startupEar. Deploy all three applications, starting with medrecEar.

   4. Select medrecEar and click Continue.

   5. Click Deploy.

   The Console displays the Deploy panel, which shows the deployment status of applications and deployment activities on the server. The table in this page shows that the deployment is underway, and then refreshes to report the success or failure of the deployment.

   6. Use steps a to c to return to the Deploy an Application page, and select and deploy physicianEar.

   7. Use steps a to c to return to the Deploy an Application page, and select and deploy startupEar.

5. Access the MedRec applications to confirm that they are deployed. In a browser, navigate to http://127.0.0.1:7101/physician, and log in using the username and password supplied in the text fields.

Best Practices

- Use the Administration Console Deployment Assistant to deploy your application in a graphical environment that shows you the choices you can make in your deployment, as an alternative to deploying using the command-line tool weblogic.Deployer or to editing Ant scripts that run deployment targets.
- For production, deploy in exploded format to simplify the process of updating the application.
- Use the Administration Console to monitor the progress of MedRec deployment and application activities. In case of errors, scroll up in the console text for useful messages.

Big Picture

The split-directory structure introduced in WebLogic Server 8.1 lets you deploy MedRec's compiled and generated files separately from the editable files. This capability is convenient during the development stage, when changes to the application are frequent. The expected format for production is the traditional single-directory structure, with the separate applications in exploded format in separate subdirectories.

In this tutorial, you deployed MedRec's applications from a directories containing the applications and all of their components and support files. The applications' exploded format makes their editable files more accessible than they would be if they were bundled into archives.

Each application subdirectory in dist contains both the compiled classes and generated deployment descriptors from the build directory, and the editable deployment descriptors and other files from the src directory.

Related Reading

- Enterprise Application Deployment Descriptor Elements in Developing WebLogic Server Applications
- Overview of WebLogic Server Deployment in Deploying WebLogic Server Applications