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

 


Developing the MedRec Applications

 


Tutorial 9: Deploying MedRec from the Development Environment

This tutorial describes how to deploy an application from a WebLogic split development directory using the wldeploy Ant task and weblogic.Deployer utilities. You can use these techniques to deploy an application quickly to a development environment without having to package the application or otherwise modify your build environment.

The tutorial includes the following sections:

 


Prerequisites

Before starting this tutorial, complete tutorials 5 through 8 to create the project directory and perform the intermediate build steps for the Physician Application. If you completed tutorial 5 but skipped one or more of the subsequent tutorials, you can catch up by moving to the c:\medrec_tutorial\src\physicianEar subdirectory, setting the environment, and using Ant to run the default build.xml file:

prompt> c:\bea\user_projects\domains\MedRecDomain\bin\setDomainEnv.cmd
prompt> cd c:\medrec_tutorial\src\physicianEar
prompt> ant -f build.xml

 


Procedure

By now you have seen how the split development directory structure helps you easily build Enterprise Applications with WebLogic Server. In this procedure you learn how easy it is to deploy Enterprise Applications with this directory structure.

Deploying Enterprise Applications sometimes seems like as much work as building them—you usually need to combine the compiled Java classes with modifiable deployment descriptors to create an exploded EAR directory or a compressed EAR file, which you then deploy. This process generally involves copying files from one place to another and changing their directory structures before deploying (not to mention repeating this process each time you rebuild the application or change a deployment descriptor).

With the split development directory, compiled files in the build directory are neatly separated from modifiable source files and descriptors in the source directory. WebLogic Server can deploy applications directly from a split development directory—you only need to target the build directory to deploy your work. In this procedure you use the split development directory to deploy physicianEar, which has now been built to the point where it is deployable:

  1. Open a command shell window and start PointBase, if it is not already running:
  2. prompt> cd c:\bea\weblogic91\common\eval\pointbase\tools
    prompt> startPointBase.cmd
  3. First start the MedRecServer if it is not already running:
    1. Open a new command shell window.
    2. Start the MedRec server by running its start script:
    3. prompt> c:\bea\user_projects\domains\medrecdomain\startweblogic.cmd
  4. Open another command shell window and set your environment:
  5. prompt> c:\bea\user_projects\domains\medrecdomain\bin\setDomainEnv.cmd
  6. Move to the physicianEar subdirectory if you are not already there:
  7. prompt> cd c:\medrec_tutorial\src\physicianEar
  8. Use a text editor to create a new file, deploy.xml:
  9. prompt> notepad deploy.xml

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

  10. Start the deploy.xml file by defining a project named tutorial:
  11. <project name="tutorial" default="deploy">
  12. Define the main target for deploying the application:
  13.   <target name="deploy">
    <wldeploy user="weblogic"
    password="weblogic"
    adminurl="t3://127.0.0.1:7101"
    action="deploy"
    name="tutorial_deployment"
    source="c:\medrec_tutorial\build\physicianEar" />
    </target>
  14. Complete the deploy.xml file by closing the project element:
  15. </project>
  16. Your file contents should now resemble the following:
  17. <project name="tutorial" default="deploy">
      <target name="deploy">
    <wldeploy user="weblogic"
    password="weblogic"
    adminurl="t3://127.0.0.1:7101"
    action="deploy"
    name="tutorial_deployment"
    source="c:\medrec_tutorial\build\physicianEar" />
    </target>
    </project>

    Save the file and exit your text editor.

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

    You should receive the following output from the wldeploy task:

    Buildfile: deploy.xml
    deploy:
     [wldeploy] weblogic.Deployer -noexit -name tutorial_deployment -source C:\medrec_tutorial\build\physicianEar -adminurl t3://127.0.0.1:7101 -user weblogic -password ******** -deploy
    [wldeploy] weblogic.Deployer invoked with options: -noexit -name tutorial_deployment -source C:\medrec_tutorial\build\physicianEar -adminurl t3://127.0.0.1:7101 -user weblogic -deploy
    [wldeploy] <Dec 9, 2005 12:13:01 PM PST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, tutorial_deployment [archive:C:\medrec_tutorial\build\physicianEar], to configured targets.>
    [wldeploy] Task 0 initiated: [Deployer:149026]deploy application tutorial_deployment on MedRecServer.
    [wldeploy] Task 0 completed: [Deployer:149026]deploy application tutorial_deployment on MedRecServer.
    [wldeploy] Target state: deploy completed on Server MedRecServer
    [wldeploy]
    BUILD SUCCESSFUL
    Total time: 30 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 deploy.xml file. If this occurs, wait until the server has finished starting up, and try to deploy using the installed tutorial file:

    prompt> ant -f wldeploy_tutorial.xml

    If you receive the following error when trying to deploy physicianEar, you might have forgotten to release the configuration when previously using the Administration Console:

    BUILD FAILED
    C:\medrec_tutorial\src\medrecEar\build.xml:256: weblogic.management.ManagementException: [Deployer:149163]The domain edit lock is owned by another session in non-exclusive mode - this deployment operation requires exclusive access to the edit lock and hence cannot proceed.

    In this case, be sure you click either Activate Changes or Release Configuration in the Change Center of the Administration Console and then rerun the deploy task.

  20. To verify that the application deployed, open a new browser window and enter the URL http://host:7101/physician, 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/physician.
  21. You should receive the Physician 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.

  22. You use the wldeploy task with the same options as those available with the weblogic.Deployer command line utility. Before moving on to the next tutorial, undeploy the Physician application using weblogic.Deployer. In the same command-line window, enter the command:
  23. prompt> java weblogic.Deployer -adminurl t3://127.0.0.1:7101 -user weblogic -password weblogic -undeploy -name tutorial_deployment

    The utility displays the following output messages:

    <Dec 9, 2005 12:16:07 PM PST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating undeploy operation for application, tutorial_deployment [archive: null], toconfigured targets.>
    Task 3 initiated: [Deployer:149026]remove application tutorial_deployment on MedRecServer.
    Task 3 completed: [Deployer:149026]remove application tutorial_deployment on MedRecServer.
    Target state: undeploy completed on Server MedRecServer
  24. Use the weblogic.Deployer utility to redeploy the physicianEar application in preparation for the next tutorial:
  25. prompt> java weblogic.Deployer -adminurl t3://127.0.0.1:7101 -user weblogic -password weblogic -deploy -name tutorial_deployment -source c:\medrec_tutorial\build\physicianEar

 


Best Practices

 


The Big Picture

How does wldeploy work with the split directory? The contents of c:\medrec_tutorial\build\physicianEar look similar to an exploded EAR directory, but there are no deployment descriptors. WebLogic Server finds the correct deployment descriptors to use by examining the c:\medrec_tutorial\build\physicianEar\.beabuild.txt file, which references the application's source directory, c:\medrec_tutorial\src\physicianEar. The source directory contains the component deployment descriptors needed to deploy the application.

 


Related Reading

 

Skip navigation bar  Back to Top Previous Next