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:
Before starting this tutorial:
- Complete tutorials 5 through 9 to create the project directory and perform the intermediate build steps for the Physician Application. If you skipped any of tutorials 6 through 9, you can catch up by setting your environment:
c:\bea\user_projects\domains\medrecdomain\setenv.cmdand then moving to the c:\medrec_tutorial\src\physicianEar subdirectory and executing the ant command:
ant -f build.xml- Complete Tutorial 13: Compiling the Entire MedRec Project .
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.
- Open a command shell and set your environment:
c:\bea\user_projects\domains\medrecdomain\setenv.cmd- Move to the src\physicianEar subdirectory of the MedRec project directory:
cd c:\medrec_tutorial\src\physicianEar
- Use a text editor to create a new file called package.xml:
notepad package.xmlNote: 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.
- In the package.xml file, define a project named tutorial and supply a default target name:
<project name="tutorial" default="package">- Define an Ant target name that you will specify when you run the script:
<target name="package">- 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.
- Complete the package.xml file by closing the project element:
</project>- 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.
- In the same command shell, enter the command to execute the build script:
ant -f package.xmlYou should receive the following output from the package task:
Buildfile: package.xmlpackage:[jar] Building jar: C:\medrec_tutorial\dist\wlpackage_tutorial.earBUILD SUCCESSFULTotal time: 4 secondsIf 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- To verify that wlpackage_tutorial.ear has been created, change to C:\medrec_tutorial\dist:
cd C:\medrec_tutorial\distand then run ls or dir.
dir wlpackage_tutorial.ear- Verify the contents of wlpackage_tutorial.ear using the jar command:
C:\medrec_tutorial\dist>jar tf wlpackage_tutorial.earYou should see the following list of files and subdirectories:
META-INF/META-INF/MANIFEST.MFAPP-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.xmlphysicianWebApp/Confirmation.jspphysicianWebApp/CreateRx.jspphysicianWebApp/CreateVisit.jspphysicianWebApp/Error.jspphysicianWebApp/Login.jspphysicianWebApp/PatientHeader.jspphysicianWebApp/PhysicianHeader.jspphysicianWebApp/Search.jspphysicianWebApp/SearchResults.jspphysicianWebApp/black.cssphysicianWebApp/ViewProfile.jspphysicianWebApp/ViewRecord.jspphysicianWebApp/ViewRecords.jspphysicianWebApp/WEB-INF/app.tldphysicianWebApp/WEB-INF/classes/com/bea/medrec/utils/Applicatio nResources.propertiesphysicianWebApp/WEB-INF/classes/com/bea/medrec/utils/Applicatio nResources_ja.propertiesphysicianWebApp/WEB-INF/struts-bean.tldphysicianWebApp/WEB-INF/struts-config.xmlphysicianWebApp/WEB-INF/struts-html.tldphysicianWebApp/WEB-INF/struts-logic.tldphysicianWebApp/WEB-INF/struts-nested.tldphysicianWebApp/WEB-INF/struts-template.tldphysicianWebApp/WEB-INF/web.xmlphysicianWebApp/WEB-INF/weblogic.xmlphysSessionEjbs/com/bea/medrec/controller/PhysicianSessionEJB.e jbwebservices_tutorial.xmlwlcompile_tutorial.xmlpackage.xmlphysicianWebApp/WEB-INF/lib/physicianWebApp/WEB-INF/classes/com/bea/medrec/actions/physicianWebApp/WEB-INF/classes/jsp_servlet/physSessionEjbs/META-INF/APP-INF/lib/exceptions.jarAPP-INF/lib/log4j-1.2.4.jarAPP-INF/lib/utils.jarAPP-INF/lib/value.jarAPP-INF/lib/webServicesEjb_client.jarphysicianWebApp/WEB-INF/lib/commons-beanutils.jarphysicianWebApp/WEB-INF/lib/commons-collections.jarphysicianWebApp/WEB-INF/lib/commons-dbcp.jarphysicianWebApp/WEB-INF/lib/commons-digester.jarphysicianWebApp/WEB-INF/lib/commons-logging.jarphysicianWebApp/WEB-INF/lib/commons-pool.jarphysicianWebApp/WEB-INF/lib/commons-services.jarphysicianWebApp/WEB-INF/lib/commons-validator.jarphysicianWebApp/WEB-INF/lib/commonWeb.jarphysicianWebApp/WEB-INF/lib/log4j-1.2.4.jarphysicianWebApp/WEB-INF/lib/struts.jarphysicianWebApp/WEB-INF/classes/com/bea/medrec/actions/CreateRx Action.classphysicianWebApp/WEB-INF/classes/com/bea/medrec/actions/PhysBase LookupDispatchAction.classphysicianWebApp/WEB-INF/classes/com/bea/medrec/actions/CreateVi sitAction.classphysicianWebApp/WEB-INF/classes/com/bea/medrec/actions/PhysBase Action.classphysicianWebApp/WEB-INF/classes/com/bea/medrec/actions/PhysLog4 jInit.classphysicianWebApp/WEB-INF/classes/com/bea/medrec/actions/PhysLogi nAction.classphysicianWebApp/WEB-INF/classes/com/bea/medrec/actions/PhysLogo utAction.classphysicianWebApp/WEB-INF/classes/com/bea/medrec/actions/PhysView ProfileAction.classphysicianWebApp/WEB-INF/classes/com/bea/medrec/actions/PhysView RecordAction.classphysicianWebApp/WEB-INF/classes/com/bea/medrec/actions/PhysView RecordsSummaryAction.classphysicianWebApp/WEB-INF/classes/com/bea/medrec/actions/SearchAc tion.classphysicianWebApp/WEB-INF/classes/com/bea/medrec/actions/SearchRe sultsAction.classphysicianWebApp/WEB-INF/classes/com/bea/medrec/utils/PhysConsta nts.classphysicianWebApp/WEB-INF/classes/jsp_servlet/__physicianheader.c lassphysicianWebApp/WEB-INF/classes/jsp_servlet/__confirmation.clas sphysicianWebApp/WEB-INF/classes/jsp_servlet/__createrx.classphysicianWebApp/WEB-INF/classes/jsp_servlet/__createvisit.classphysicianWebApp/WEB-INF/classes/jsp_servlet/__error.classphysicianWebApp/WEB-INF/classes/jsp_servlet/__login.classphysicianWebApp/WEB-INF/classes/jsp_servlet/__patientheader.cla ssphysicianWebApp/WEB-INF/classes/jsp_servlet/__search.classphysicianWebApp/WEB-INF/classes/jsp_servlet/__searchresults.cla ssphysicianWebApp/WEB-INF/classes/jsp_servlet/__viewprofile.classphysicianWebApp/WEB-INF/classes/jsp_servlet/__viewrecord.classphysicianWebApp/WEB-INF/classes/jsp_servlet/__viewrecords.classphysSessionEjbs/com/bea/medrec/controller/PhysicianSessionEJB.c lassphysSessionEjbs/com/bea/medrec/controller/PhysicianSessionHome. classphysSessionEjbs/com/bea/medrec/controller/PhysicianSession.clas sphysSessionEjbs/com/bea/medrec/controller/PhysicianClientUtils. classphysSessionEjbs/com/bea/medrec/controller/PhysicianSessionEJB_n 7enxc_Intf.classphysSessionEjbs/com/bea/medrec/controller/PhysicianSessionEJB_n 7enxc_Impl.classphysSessionEjbs/com/bea/medrec/controller/PhysicianSessionEJB_n 7enxc_EOImpl.classphysSessionEjbs/com/bea/medrec/controller/PhysicianSessionEJB_n 7enxc_HomeImpl.classphysSessionEjbs/com/bea/medrec/controller/PhysicianSessionEJB_n 7enxc_HomeImplRTD.xmlphysSessionEjbs/com/bea/medrec/controller/PhysicianSessionEJB_n 7enxc_EOImplRTD.xmlphysSessionEjbs/ejbgen-build.xmlphysSessionEjbs/META-INF/weblogic-ejb-jar.xmlphysSessionEjbs/META-INF/ejb-jar.xmlphysSessionEjbs/_WL_GENERATEDThe EAR file you have created contains the Physician application bundled into a deployable archive.
To confirm that the archive is deployable, use the Administration Console Deployment Assistant to deploy it to MedRecServer.
- With MedRecServer running, access the Administration Console at http://localhost:7101/console.
- In the left-hand pane, expand Deployments and select Applications.
- In the right-hand pane, select Deploy a new Application.
- Use the Location links to select C:\medrec_tutorial\dist.
- Select wlpackage_tutorial.ear and click Continue.
- In the Deploy an Application page, verify that MedRecServer is the targeted server and click Deploy.
- 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.
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.
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
- Enterprise Application Deployment Descriptor Elements in Developing WebLogic Server Applications
- Overview of WebLogic Server Deployment in Deploying WebLogic Server Applications