Avitek Medical Records Development Tutorials

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Moving to Production

 


Tutorial 14: Packaging MedRec for Distribution

In previous tutorials you configured, compiled, and deployed MedRec in a split-directory development environment. This tutorial describes how to use an Ant script to package the compiled medrecEar application into a single portable EAR that you can hand off to a production team.

The tutorial includes:

 


Prerequisites

Complete Tutorial 13: Compiling the Entire MedRec Project.

 


Procedure

Step 1: Package the medrecEar application as an EAR archive file.

The following procedures create and run a script that packages the contents of the medrecEar application from the directories used in the split-directory development environment—src and build—into a single deployable, distributable EAR file in a distribution directory, dist.

  1. Open a command shell and set your environment:
  2. prompt> c:\bea\user_projects\domains\MedRecDomain\bin\setDomainEnv.cmd
  3. Move to the src\medrecEar subdirectory of the MedRec project directory:
  4. prompt> cd c:\medrec_tutorial\src\medrecEar
  5. Use a text editor to create a new file called package.xml:
  6. prompt> notepad package.xml
    Note: If you do not want to create the package.xml file manually in this tutorial, copy the file named wlpackage_tutorial.xml to the new name, package.xml, and skip to step 9.
  7. In the package.xml file, define a project named tutorial and supply a default target name:
  8. <project name="tutorial" default="package">
  9. Define an Ant target name that you will specify when you run the script:
  10. <target name="package">
  11. Provide the argument of the Ant target, which calls the wlpackage Ant task and combines the contents of the src and build physicianEAR directories into a single directory in dist.
  12. <wlpackage srcdir="c:/medrec_tutorial/src/medrecEar"
    destdir="c:/medrec_tutorial/build/medrecEar"
    toFile="c:/medrec_tutorial/dist/wlpackage_tutorial.ear" />
    </target>

    See Packaging Applications Using wlpackage for more information about the wlpackage task.

  13. Complete the package.xml file by closing the project element:
  14. </project>
  15. Your file contents should now resemble the following:
  16. <project name="tutorial" default="package">
       <target name="package">
       <wlpackage srcdir="c:/medrec_tutorial/src/medrecEar"
    destdir="c:/medrec_tutorial/build/medrecEar"
    toFile="c:/medrec_tutorial/dist/wlpackage_tutorial.ear" />
       </target>
    </project>

    Save the file and exit your text editor.

  17. In the same command shell, enter the command to execute the build script:
  18. prompt> ant -f package.xml

    You should receive the following output from the wlpackage task:

    Buildfile: package.xml
    package:
    [jar] Building jar: C:\medrec_tutorial\dist\wlpackage_tutorial.ear
    BUILD SUCCESSFUL
    Total time: 1 second

    If you do not receive the above output, you may have made a typo in creating the package.xml file. If this occurs, try to package using the installed tutorial file:

    prompt> ant -f wlpackage_tutorial.xml
  19. To verify that wlpackage_tutorial.ear has been created, change to the MedRec dist directory and use the dir command to view a contents of the directory:
  20. prompt> cd c:\medrec_tutorial\dist
    prompt> dir wlpackage_tutorial.ear
  21. Verify the contents of wlpackage_tutorial.ear using the jar command:
  22. prompt> jar tf wlpackage_tutorial.ear

    The full list of files (over 700) is too long to include in this section, but the list will typically start with the following files:

    META-INF/
    META-INF/MANIFEST.MF
    META-INF/application.html
    META-INF/application.xml
    META-INF/weblogic-application.html
    META-INF/weblogic-application.xml
    META-INF/weblogic-diagnostics.html
    META-INF/weblogic-diagnostics.xml
    adminWebApp/
    adminWebApp/ConfirmImport.html
    adminWebApp/ConfirmImport.jsp
    adminWebApp/CreateAdminSuccessful.html
    adminWebApp/CreateAdminSuccessful.jsp
    adminWebApp/CreateNewAdmin.html
    adminWebApp/CreateNewAdmin.jsp
    adminWebApp/Diagnostics.html
    adminWebApp/Diagnostics.jsp
    adminWebApp/Error.html
    adminWebApp/Error.jsp
    adminWebApp/Header.html
    adminWebApp/Header.jsp
    adminWebApp/Home.html
    adminWebApp/Home.jsp
    adminWebApp/Login.html
    adminWebApp/Login.jsp
    adminWebApp/Logs.html
    adminWebApp/Logs.jsp
    adminWebApp/MedRecSchema.html
    adminWebApp/MedRecSchema.xsd
    adminWebApp/ViewImportRecords.html
    adminWebApp/ViewImportRecords.jsp
    adminWebApp/ViewPatientRequest.html
    adminWebApp/ViewPatientRequest.jsp
    adminWebApp/ViewRequests.html
    adminWebApp/ViewRequests.jsp
    adminWebApp/WEB-INF/
    adminWebApp/WEB-INF/classes/
    ...

The EAR file you have created contains the medrecEar application bundled into a deployable archive.

Step 2: Test the package.

To confirm that the archive is deployable, use the Administration Console Deployment Assistant to deploy it to MedRecServer.

  1. With MedRecServer running, open the Administration Console by navigating in a browser to:
  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 middle left-hand pane called Domain Structure, click MedRecDomainArrow symbolDeployments.
  5. If you have completed the previous tutorials in sequence, you should see the physicianEAR (with the deployment name tutorial_deployment) and MedRecEar applications already listed in the Deployments table in the right pane. The previous tutorials deployed the two applications within the split development directory environment rather than as a deployable archive. If either of the applications is deployed, uninstall it as follows:

    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 application (such as MedRecEar) by checking the box to the left of its application name.
    3. Click StopArrow symbolForce 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.
    9. Repeat the preceding steps, if necessary, to stop and undeploy the physicianEar application.
  6. Click Lock & Edit, located in the upper left Change Center window of the Administration Console.
  7. In the right-hand pane, click Install.
  8. Use the Location links to navigate to the C:\medrec_tutorial\dist directory.
  9. Select wlpackage_tutorial.ear.
  10. Click Next.
  11. In the Choose Targeting Style page, select Install this deployment as an application.
  12. Click Next until you see the Review Your Choices and Click Finish page.
  13. Review your choices and click Finish when you are satisfied that your choices are correct.

  14. The assistant automatically takes you to the configuration tabs for the deployed application. Select the tabs if you want to view configuration information about the application.
  15. In the Change Center, click Activate Changes to update the MedRec server configuration.
  16. In the configuration pages of the application, select the Control tab.
  17. In the Enterprise Application table, select wlpackage_tutorial by checking the box to the left of its name.
  18. This table also lists the Web applications, EJBs, and Web Services that are packaged in the EAR; expand wlpackage_tutorial to see the list.

  19. Click StartArrow symbolServicing all requests.
  20. Click Yes.
  21. As soon as WebLogic Server has completely started the application, the value in the State column changes from Prepared to Active. This means that client applications can now start using the medrecEar application (which is packaged in the wlpackage_tutorial archive).

  22. To verify that the application deployed and started, open a new browser window and enter the URL http://host:7101/patient, where host refers to the computer that hosts MedRecServer. If your browser is on the same computer as MedRecServer, you can use the URL http://localhost:7101/patient.
  23. You should receive the Patient Application's login page. You cannot do much more than look at the page right now, because the rest of the MedRec application suite is not yet available.

 


Best Practices

Creating an actual *.ear archive file of an application with the wlpackage Ant task is most useful when you want to distribute or hand off the application to a production team. However, when you actually deploy the application for production, consider deploying your application in exploded, unarchived format. Doing so allows you to access and update files, for example deployment descriptor files, without having to unarchive and then rearchive the entire application. See Tutorial 15: Using WLST and the Administration Console to Deploy the MedRec Package for Productionfor instructions on deploying MedRec in exploded format.

 


The Big Picture

In this tutorial, you packaged the medrecEar application into a single portable EAR file suitable for handing off to a production team. Because of the wlpackage Ant task, the split directory structure for development presents no obstacle to switching to a manageable single directory structure for production.

 


Related Reading


  Back to Top       Previous  Next