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 Physician application into a single portable EAR that you can hand off to a production team.

The tutorial includes the following sections:

Prerequisites

Before starting this tutorial:

Procedure

Step 1: Package the Physician application as an EAR.

The following procedures create and run a script that packages the contents of the Physician 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:
    c:\bea\user_projects\domains\medrecdomain\setenv.cmd
    
    

  2. Move to the src\physicianEar subdirectory of the MedRec project directory:

    cd c:\medrec_tutorial\src\physicianEar

  3. Use a text editor to create a new file called package.xml:
    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.

  4. In the package.xml file, define a project named tutorial and supply a default target name:
    <project name="tutorial" default="package">
    
    

  5. Define an Ant target name that you will specify when you run the script:
    <target name="package">
    
    

  6. 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.
    <wlpackage srcdir="c:/medrec_tutorial/src/physicianEar" 
    destdir="c:/medrec_tutorial/build/physicianEar"
    
    
    toFile="c:/medrec_tutorial/dist/wlpackage_tutorial.ear" />
    
    
    </target>
    
    

    See Split Development Directory Ant Tasks for more information about the wlpackage task.

  7. Complete the package.xml file by closing the project element:
    </project>
    
    

  8. Your file contents should now resemble the following:
    <project name="tutorial" default="package">
    
    
    <target name="package">
    
    
    <wlpackage srcdir="c:/medrec_tutorial/src/physicianEar" 
    destdir="c:/medrec_tutorial/build/physicianEar"
    
    
    toFile="c:/medrec_tutorial/dist/wlpackage_tutorial.ear" />
    
    
    </target>
    
    
    </project>
    
    

    Save the file and exit your text editor.

  9. In the same command shell, enter the command to execute the build script:
    ant -f package.xml
    
    

    You should receive the following output from the package task:

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

    If you do not receive the above output, MedRecServer may not have finished starting up, or you may have made a typo in creating the package.xml file. If this occurs, wait until the server has finished starting up, and try to package using the installed tutorial file:

    ant -f wlpackage_tutoria1.xml
    
    

  10. To verify that wlpackage_tutorial.ear has been created, change to C:\medrec_tutorial\dist:
    cd C:\medrec_tutorial\dist
    
    

    and then run ls or dir.

    dir wlpackage_tutorial.ear
    
    

  11. Verify the contents of wlpackage_tutorial.ear using the jar command:
    C:\medrec_tutorial\dist>jar tf wlpackage_tutorial.ear
    
    

    You should see the following list of files and subdirectories:

    META-INF/
    
    
    META-INF/MANIFEST.MF
    
    
    APP-INF/
    
    
    APP-INF/classes/
    
    
    APP-INF/lib/
    
    
    physicianWebApp/
    
    
    physicianWebApp/WEB-INF/
    
    
    physicianWebApp/WEB-INF/classes/
    
    
    physicianWebApp/WEB-INF/classes/com/
    
    
    physicianWebApp/WEB-INF/classes/com/bea/
    
    
    physicianWebApp/WEB-INF/classes/com/bea/medrec/
    
    
    physicianWebApp/WEB-INF/classes/com/bea/medrec/utils/
    
    
    physicianWebApp/WEB-INF/src/
    
    
    physicianWebApp/WEB-INF/src/com/
    
    
    physicianWebApp/WEB-INF/src/com/bea/
    
    
    physicianWebApp/WEB-INF/src/com/bea/medrec/
    
    
    physicianWebApp/WEB-INF/src/com/bea/medrec/actions/
    
    
    physicianWebApp/WEB-INF/src/com/bea/medrec/utils/
    
    
    physSessionEjbs/
    
    
    physSessionEjbs/com/
    
    
    physSessionEjbs/com/bea/
    
    
    physSessionEjbs/com/bea/medrec/
    
    
    physSessionEjbs/com/bea/medrec/controller/
    
    
    META-INF/application.xml
    
    
    physicianWebApp/Confirmation.jsp
    
    
    physicianWebApp/CreateRx.jsp
    
    
    physicianWebApp/CreateVisit.jsp
    
    
    physicianWebApp/Error.jsp
    
    
    physicianWebApp/Login.jsp
    
    
    physicianWebApp/PatientHeader.jsp
    
    
    physicianWebApp/PhysicianHeader.jsp
    
    
    physicianWebApp/Search.jsp
    
    
    physicianWebApp/SearchResults.jsp
    
    
    physicianWebApp/black.css
    
    
    physicianWebApp/ViewProfile.jsp
    
    
    physicianWebApp/ViewRecord.jsp
    
    
    physicianWebApp/ViewRecords.jsp
    
    
    physicianWebApp/WEB-INF/app.tld
    
    
    physicianWebApp/WEB-INF/classes/com/bea/medrec/utils/Applicatio
    nResources.properties
    
    
    physicianWebApp/WEB-INF/classes/com/bea/medrec/utils/Applicatio
    nResources_ja.properties
    
    
    physicianWebApp/WEB-INF/struts-bean.tld
    
    
    physicianWebApp/WEB-INF/struts-config.xml
    
    
    physicianWebApp/WEB-INF/struts-html.tld
    
    
    physicianWebApp/WEB-INF/struts-logic.tld
    
    
    physicianWebApp/WEB-INF/struts-nested.tld
    
    
    physicianWebApp/WEB-INF/struts-template.tld
    
    
    physicianWebApp/WEB-INF/web.xml
    
    
    physicianWebApp/WEB-INF/weblogic.xml
    
    
    physSessionEjbs/com/bea/medrec/controller/PhysicianSessionEJB.e
    jb
    
    
    webservices_tutorial.xml
    
    
    wlcompile_tutorial.xml
    
    
    package.xml
    
    
    physicianWebApp/WEB-INF/lib/
    
    
    physicianWebApp/WEB-INF/classes/com/bea/medrec/actions/
    
    
    physicianWebApp/WEB-INF/classes/jsp_servlet/
    
    
    physSessionEjbs/META-INF/
    
    
    APP-INF/lib/exceptions.jar
    
    
    APP-INF/lib/log4j-1.2.4.jar
    
    
    APP-INF/lib/utils.jar
    
    
    APP-INF/lib/value.jar
    
    
    APP-INF/lib/webServicesEjb_client.jar
    
    
    physicianWebApp/WEB-INF/lib/commons-beanutils.jar
    
    
    physicianWebApp/WEB-INF/lib/commons-collections.jar
    
    
    physicianWebApp/WEB-INF/lib/commons-dbcp.jar
    
    
    physicianWebApp/WEB-INF/lib/commons-digester.jar
    
    
    physicianWebApp/WEB-INF/lib/commons-logging.jar
    
    
    physicianWebApp/WEB-INF/lib/commons-pool.jar
    
    
    physicianWebApp/WEB-INF/lib/commons-services.jar
    
    
    physicianWebApp/WEB-INF/lib/commons-validator.jar
    
    
    physicianWebApp/WEB-INF/lib/commonWeb.jar
    
    
    physicianWebApp/WEB-INF/lib/log4j-1.2.4.jar
    
    
    physicianWebApp/WEB-INF/lib/struts.jar
    
    
    physicianWebApp/WEB-INF/classes/com/bea/medrec/actions/CreateRx
    Action.class
    
    
    physicianWebApp/WEB-INF/classes/com/bea/medrec/actions/PhysBase
    LookupDispatchAction.class
    
    
    physicianWebApp/WEB-INF/classes/com/bea/medrec/actions/CreateVi
    sitAction.class
    
    
    physicianWebApp/WEB-INF/classes/com/bea/medrec/actions/PhysBase
    Action.class
    
    
    physicianWebApp/WEB-INF/classes/com/bea/medrec/actions/PhysLog4
    jInit.class
    
    
    physicianWebApp/WEB-INF/classes/com/bea/medrec/actions/PhysLogi
    nAction.class
    
    
    physicianWebApp/WEB-INF/classes/com/bea/medrec/actions/PhysLogo
    utAction.class
    
    
    physicianWebApp/WEB-INF/classes/com/bea/medrec/actions/PhysView
    ProfileAction.class
    
    
    physicianWebApp/WEB-INF/classes/com/bea/medrec/actions/PhysView
    RecordAction.class
    
    
    physicianWebApp/WEB-INF/classes/com/bea/medrec/actions/PhysView
    RecordsSummaryAction.class
    
    
    physicianWebApp/WEB-INF/classes/com/bea/medrec/actions/SearchAc
    tion.class
    
    
    physicianWebApp/WEB-INF/classes/com/bea/medrec/actions/SearchRe
    sultsAction.class
    
    
    
    
    
    physicianWebApp/WEB-INF/classes/com/bea/medrec/utils/PhysConsta
    nts.class
    
    
    physicianWebApp/WEB-INF/classes/jsp_servlet/__physicianheader.c
    lass
    
    
    physicianWebApp/WEB-INF/classes/jsp_servlet/__confirmation.clas
    s
    
    
    physicianWebApp/WEB-INF/classes/jsp_servlet/__createrx.class
    
    
    physicianWebApp/WEB-INF/classes/jsp_servlet/__createvisit.class
    
    
    physicianWebApp/WEB-INF/classes/jsp_servlet/__error.class
    
    
    physicianWebApp/WEB-INF/classes/jsp_servlet/__login.class
    
    
    physicianWebApp/WEB-INF/classes/jsp_servlet/__patientheader.cla
    ss
    
    
    physicianWebApp/WEB-INF/classes/jsp_servlet/__search.class
    
    
    physicianWebApp/WEB-INF/classes/jsp_servlet/__searchresults.cla
    ss
    
    
    physicianWebApp/WEB-INF/classes/jsp_servlet/__viewprofile.class
    
    
    physicianWebApp/WEB-INF/classes/jsp_servlet/__viewrecord.class
    
    
    physicianWebApp/WEB-INF/classes/jsp_servlet/__viewrecords.class
    
    
    physSessionEjbs/com/bea/medrec/controller/PhysicianSessionEJB.c
    lass
    
    
    physSessionEjbs/com/bea/medrec/controller/PhysicianSessionHome.
    class
    
    
    physSessionEjbs/com/bea/medrec/controller/PhysicianSession.clas
    s
    
    
    physSessionEjbs/com/bea/medrec/controller/PhysicianClientUtils.
    class
    
    
    physSessionEjbs/com/bea/medrec/controller/PhysicianSessionEJB_n
    7enxc_Intf.class
    
    
    physSessionEjbs/com/bea/medrec/controller/PhysicianSessionEJB_n
    7enxc_Impl.class
    
    
    physSessionEjbs/com/bea/medrec/controller/PhysicianSessionEJB_n
    7enxc_EOImpl.class
    
    
    physSessionEjbs/com/bea/medrec/controller/PhysicianSessionEJB_n
    7enxc_HomeImpl.class
    
    
    physSessionEjbs/com/bea/medrec/controller/PhysicianSessionEJB_n
    7enxc_HomeImplRTD.xml
    
    
    physSessionEjbs/com/bea/medrec/controller/PhysicianSessionEJB_n
    7enxc_EOImplRTD.xml
    
    
    physSessionEjbs/ejbgen-build.xml
    
    
    physSessionEjbs/META-INF/weblogic-ejb-jar.xml
    
    
    physSessionEjbs/META-INF/ejb-jar.xml
    
    
    physSessionEjbs/_WL_GENERATED
    
    

The EAR file you have created contains the Physician 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, access the Administration Console at http://localhost:7101/console.

  2. In the left-hand pane, expand Deployments and select Applications.

  3. In the right-hand pane, select Deploy a new Application.

  4. Use the Location links to select C:\medrec_tutorial\dist.

  5. Select wlpackage_tutorial.ear and click Continue.

  6. In the Deploy an Application page, verify that MedRecServer is the targeted server and click Deploy.

  7. The Deploy panel shows the status of the deployment. It refreshes to update the status, and on completion shows the success or failure of the deployment.

Best Practices

For actual deployment for production, package 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 14: Deploying the MedRec Package for Production for instructions on deploying MedRec in exploded format.

The Big Picture

In this tutorial, you packaged the Physician application into a single portable EAR file suitable for handing off to a production team. 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