![]() ![]() ![]() ![]() ![]() ![]() |
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.
Complete Tutorial 13: Compiling the Entire MedRec Project.
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
.
prompt> c:\bea\user_projects\domains\MedRecDomain\bin\setDomainEnv.cmd
src\medrecEar
subdirectory of the MedRec project directory:prompt> cd c:\medrec_tutorial\src\medrecEar
package.xml
: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. |
package.xml
file, define a project named tutorial
and supply a default target name:<project name="tutorial" default="package">
Ant
target name that you will specify when you run the script: <target name="package">
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/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.
package.xml
file by closing the project element:</project>
<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.
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
wlpackage_tutorial.ear
has been created, change to the MedRec
dist directory and use the dir
command to view a contents of the directory:prompt> cd c:\medrec_tutorial\dist
prompt> dir wlpackage_tutorial.ear
wlpackage_tutorial.ear
using the jar
command: 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/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/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
...
The EAR
file you have created contains the medrecEar
application bundled into a deployable archive.
To confirm that the archive is deployable, use the Administration Console Deployment Assistant to deploy it to MedRecServer
.
MedRecServer
running, open the Administration Console by navigating in a browser to: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
.
weblogic
for both the username and password and click Log In.
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:
MedRecEar
) by checking the box to the left of its application name.physicianEar
application.C:\medrec_tutorial\dist
directory.wlpackage_tutorial.ear
.Install this deployment as an application
.Review your choices and click Finish when you are satisfied that your choices are correct.
wlpackage_tutorial
by checking the box to the left of its name.
This table also lists the Web applications, EJBs, and Web Services that are packaged in the EAR; expand wlpackage_tutorial
to see the list.
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).
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
.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.
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.
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.
![]() ![]() ![]() |