![]() ![]() ![]() ![]() ![]() ![]() |
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:
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
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:
prompt> cd c:\bea\weblogic92\common\eval\pointbase\tools
prompt> startPointBase.cmd
MedRecServer
if it is not already running:prompt> c:\bea\user_projects\domains\medrecdomain\bin\setDomainEnv.cmd
physicianEar
subdirectory if you are not already there:prompt> cd c:\medrec_tutorial\src\physicianEar
deploy.xml
: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. |
deploy.xml
file by defining a project named tutorial
:<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>
deploy.xml
file by closing the project element:</project>
<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.
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] <Jul 24, 2006 3:02:24 PM PDT> <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: 5 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\physicianEar\wldeploy_tutorial.xml:10: 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.
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
.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.
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: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:
<Jul 24, 2006 3:07:08 PM PDT> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating undeploy operation for application, tutorial_deployment [archive: null], to configured targets.>
Task 5 initiated: [Deployer:149026]remove application tutorial_deployment on MedRecServer.
Task 5 completed: [Deployer:149026]remove application tutorial_deployment on MedRecServer.
Target state: undeploy completed on Server MedRecServer
weblogic.Deployer
utility to redeploy the physicianEar
application in preparation for the next tutorial: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
weblogic.Deployer
tool or its associated Ant task, wldeploy
to target the build directory to a server running in development mode. wlcompile
to regenerate and recompile components. You should generally add deploy, redeploy, and undeploy targets to your build files to your project build scripts to facilitate these functions.
To redeploy using the wldeploy
task, simply replace action="deploy" with action="redeploy", and omit the source
definition; wldeploy
uses the deployment name to redeploy the application. Similarly, to undeploy, replace action="redeploy"
with action="undeploy"
.
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.
![]() ![]() ![]() |