Skip navigation.

Avitek Medical Records Development Tutorials

  Previous Next vertical dots separating previous/next from contents/index/pdf Contents View as PDF   Get Adobe Reader

 


Moving to Production

 


Tutorial 15: Using WLST and the Administration Console to Deploy the MedRec Package for Production

This tutorial describes how to use the WebLogic Scripting Tool (WLST) and 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, startBrowserEar, physicianEar, and initEar subdirectories of the dist directory, created in Tutorial 13: Compiling the Entire MedRec Project.

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

The tutorial includes:

 


Prerequisites

Before starting this tutorial:

 


Procedure

To deploy the MedRec applications for production:

Step 1: Start PointBase and the MedRec server.

  1. Start PointBase, if it is not already running.
  2. See Step 1: Start the PointBase database.

  3. Start the MedRec server, if it is not already running.
  4. From the Windows start menu:

    Start—>Programs—>BEA Products—>User Projects—>MedRecDomain—>Start Admin Server for WebLogic Server Domain

    From the command line:

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

Step 2: Delete the applications that have already been deployed.

To ensure that you start from a clean slate, use the Administration Console to delete the various MedRec applications that you might have deployed as part of the preceding tutorials:

  1. Open the Administration Console by navigating in a browser to the following URL:
  2. http://host:7101/console

    where host refers to the computer on which MedRecServer is running. If your browser is on the same computer as MedRecServer, then you can use the URL http://localhost:7101/console.

  3. Specify weblogic for both the username and password, and click Log In.
  4. In the left Domain Structure pane, click MedRecDomain—>Deployments.
  5. If the Deployments table in the right pane lists applications from previous tutorials, delete them by following these steps for each application:
    1. If you have not already done so, click Lock & Edit, located in the upper left Change Center window of the Administration Console.
    2. In the Deployments table, select the deployments from previous tutorials (such as tutorial_deployment and wlpackage_tutorial) by checking the box to the left of the application name.
    3. Click Stop—>Force Stop Now to ensure that the application is stopped.
    4. Click Yes.
    5. In the Deployments table, select the application again.
    6. Click Delete.
    7. Click Yes.
    8. In the Change Center, click Activate Changes to update the MedRec server configuration.

Step 3: Deploy medrecEar using WLST.

The following procedure shows how to use the WebLogic Scripting Tool (WLST) to deploy medrecEar to WebLogic Server for production.

The WebLogic Scripting Tool (WLST) is a command-line scripting interface that system administrators and operators use to monitor and manage WebLogic Server instances and domains. The WLST scripting environment is based on the Java scripting interpreter, Jython.

System administrators typically use WLST to:

WLST functionality also includes the capabilities of the WebLogic Server command-line utilities such as the wlconfig Ant task and the weblogic.Deployer utility. This procedure first describes how to create a Jython script that includes WLST commands, such as connect and deploy, and then how to create an Ant build file that invokes the WLST tool and passes it the Jython script file as an argument. You can also use WLST interactively, although this feature is not discussed in this tutorial.

  1. Open a command window and set your environment:
  2. prompt> c:\bea\user_projects\domains\medrecdomain\bin\setDomainEnv.cmd
  3. Move to the medrecEar subdirectory:
  4. prompt> cd c:\medrec_tutorial\src\medrecEar
  5. Use a text editor to create a new file called deploy.py; this file will contain the WLST commands. For example:
  6. prompt> notepad deploy.py

    Note: If you do not want to create the deploy.py file manually in this tutorial, copy the file named deploy_tutorial.py to a new file named deploy.py and follow along.

  7. Add the following lines to the deploy.py file (substituting, if necessary, your actual MedRec project directory for c:\medrec_tutorial); the WLST commands are described at the end of this step:
  8. userName = "weblogic"
    passWord = "weblogic"
    url="t3://localhost:7101"
    connect(userName, passWord, url)
    progress= deploy(
    'medrecEar',
    'c:\medrec_tutorial\dist\medrecEar',
    targets='MedRecServer',
    subModuleTargets='MedRecJMSServer@MedRecAppScopedJMS@MedRecJMSServer',
    securityModel='CustomRolesAndPolicies' )
    progress.printStatus()
    disconnect()
    exit()

    The userName, passWord, and url variables simply set up the value of the administration user, password, and the URL used to connect to the Administration Server. The connect WLST command connects to the MedRecServer using these variables. The progress variable captures a WLSTProgress object that defines the status of the deployment. The deploy command deploys the medrecEar application. In addition to the standard options, such as the source (c:\medrec_tutorial\dist\medrecEar) and deployment targets, the deploy command also specifies these additional options: subModuleTargets to specify the sub-deployment level of the application-scoped JMS modules included in medrecEar and securityModel to specify that the medrecEar application uses custom security roles and policies. Finally, the printStatus method of the progress variable prints out the status of the deployment. The disconnect command closes the connection and the exit command closes the scripting shell.

  9. Save and close the file.
  10. Use a text editor to create a new file called wlst_deploy.xml. For example:
  11. prompt> notepad wlst_deploy.xml

    Note: If you do not want to create the wlst_deploy.xml file manually in this tutorial, copy the file named wlst_tutorial.xml to a new file named wlst_deploy.xml and follow along.

  12. Start the wlst_deploy.xml file by defining a project named wlst_tutorial with a default target deploy:
  13. <project name="wlst_tutorial" default="deploy">
  14. Define the main target for executing the WLST Java utility; use the arg task to specify the deploy.py argument:
  15. <target name="deploy">
    <java classname="weblogic.WLST" fork="yes">
    <arg line="deploy.py" />
    </java>
    </target>

    The Java classname of WLST is weblogic.WLST, as specified by the classname attribute of the java task.

  16. Complete the wlst_deploy.xml file by closing the project element:
  17. </project>
  18. Your file contents should now resemble the following:
  19. <project name="wlst_tutorial" default="deploy">
      <target name="deploy">
    <java classname="weblogic.WLST" fork="yes">
    <arg line="deploy.py" />
    </java>
    </target>
    </project>

    Save the file and exit your text editor.

  20. In the same command shell, enter the command to execute the build script:
  21. prompt> ant -f wlst_deploy.xml

    You should output similar to the following from WLST:

    Buildfile: wlst_deploy.xml
    deploy:
         [java] Initializing WebLogic Scripting Tool (WLST) ...
         [java] Welcome to WebLogic Server Administration Scripting Shell
         [java] Type help() for help on available commands
         [java] Connecting to weblogic server instance running at t3://localhost:7101 as username weblogic ...
         [java] Successfully connected to Admin Server 'MedRecServer' that belongs to domain 'MedRecDomain'.
         [java] Warning: An insecure protocol was used to connect to the server.
    [java] To ensure on-the-wire security, the SSL port or Admin port
    [java] should be used instead.
         [java] Deploying application from c:\medrec_tutorial\dist\medrecEar to targets MedRecServer upload=false ...
    [java] <Dec 12, 2005 3:17:27 PM PST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, medrecEar [archive: C:\medrec_tutorial\dist\medrecEar], to MedRecJMSServer MedRecServer .>
    [java] ...Completed the deployment of Application with status
    [java] Current Status of your Deployment:
    [java] Deployment command type: deploy
    [java] Deployment State : completed
    [java] Deployment Message : no message
    [java] Current Status of your Deployment:
    [java] Deployment command type: deploy
    [java] Deployment State : completed
    [java] Deployment Message : no message
         [java] Disconnected from weblogic server: MedRecServer
         [java] Exiting WebLogic Scripting Tool ...
         [java] <Dec 12, 2005 3:17:37 PM PST> <Warning> <JNDI> <BEA-050001> <WLContext.close() was called in a different thread than the one in which it was created.>
    BUILD SUCCESSFUL
    Total time: 48 seconds
  22. Using the Administration Console, verify that medrecEar appears in the Deployments table and is in an Active state. See the first few steps in Step 2: Delete the applications that have already been deployed. for details.

Step 4: In the Administration Console, deploy physicianEar, initEar, and startBrowserEar .

Deploy the remaining MedRec applications to WebLogic Server as follows. See Step 2: Delete the applications that have already been deployed. for details on invoking the Administration Console in your browser.

  1. Click Lock & Edit, located in the upper left Change Center window of the Administration Console.
  2. In the left Domain Structure pane, click MedRecDomain—>Deployments.
  3. In the Deployments table in the right pane, click Install.
  4. Use the links in the Location field to navigate to C:\medrec_tutorial\dist.
  5. Select physicianEar and click Next.
  6. In the Choose Targeting Style window, select Install this deployment as an application and click Next.
  7. In the Optional Settings window, in the Security section, select Advanced: Use a custom model that you have configured on the realm's configuration page.
  8. This choice ensures that you can use the Administration Console to configure custom security roles and policies for the deployment.

  9. Click Next.
  10. In the Review Your Choices And Click Finish window, select No, I will review the configuration later in the Additional Configuration section.
  11. Review your other choices to ensure that all are correct. The Summary should look something like the following:

    Deployment:         C:\medrec_tutorial\dist\physicianEar
    Name: physicianEar
    Staging mode: Use the defaults defined by the chosen targets
    Security Model: Advanced: Use a custom model that you have configured on the realm's configuration page.
  12. Click Finish.
  13. Repeat steps 2 through 10 to install the initEar and startBrowserEar applications.
  14. In the Change Center, click Activate Changes to update your configuration.
  15. In the Deployments table, select the three applications you just installed.
  16. Click Start—>Servicing all requests.
  17. Click Yes.
  18. As soon as MedRecServer starts the applications, the State column for each application in the Deployments table should say Active.

    You might also see the main MedRec informational page appear in your browser.

  19. Confirm that the MedRec applications are deployed by navigating to the following login pages in a browser:
  20. In the preceding URLs, host refers to the computer that hosts MedRecServer. If your browser is on the same computer as MedRecServer, you can use localhost; for example, http://localhost:7101/physician.

    You cannot do much more than look at the login pages right now, because these pages require security that you have not yet configured. This task is described in the next few tutorials.

 


Best Practices

 


Big Picture

The split development directory framework allows you to 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, however, 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 directories that contained 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

 

Skip navigation bar  Back to Top Previous Next