Developing Applications with WebLogic Server
The following sections describe the steps for deploying WebLogic Server J2EE applications using the WebLogic split development directory environment:
The wldeploy
task provides an easy way to deploy directly from the split development directory. wlcompile
provides most of the same arguments as the weblogic.Deployer
directory. To deploy from a split development directory, you simply identify the build directory location as the deployable files, as in:
<wldeploy user="${user}" password="${password}"
action="deploy" source="${dest.dir}"
name="helloWorldEar" />
The above task is automatically created when you use weblogic.BuildXMLGen
to create the build.xml
file.
See wldeploy Ant Task Reference for a complete command reference.
The wlpackage
Ant task uses the contents of both the source and build directories to create either a deployable archive file (.EAR
file), or an exploded archive directory representing the Enterprise Application (exploded .EAR
directory). Use wlpackage
when you want to deliver your application to another group or individual for evaluation, testing, performance profiling, or production deployment.
For production purposes, it is convenient to deploy Enterprise applications in exploded (unarchived) directory format. This applies also to stand-alone Web applications, EJBs, and connectors packaged as part of an Enterprise application. Using this format allows you to update files directly in the exploded directory rather than having to unarchive, edit, and rearchive the whole application. Using exploded archive directories also has other benefits, as described in Deployment Archive Files Versus Exploded Archive Directories in Deploying Applications to WebLogic Server.
You can also package applications in a single archived file, which is convenient for packaging modules and applications for distribution. Archive files are easier to copy, they use up fewer file handles than an exploded directory, and they can save disk space with file compression.
The Java classloader can search for Java class files (and other file types) in a JAR file the same way that it searches a directory in its classpath. Because the classloader can search a directory or a JAR file, you can deploy J2EE modules on WebLogic Server in either a JAR (archived) file or an exploded (unarchived) directory.
In a production environment, use the wlpackage Ant task to package your split development directory application as a traditional EAR file that can be deployed to WebLogic Server. Continuing with the MedRec example, you would package your application as follows:
<wlpackage toFile="\physicianEAR\physicianEAR.ear" srcdir="\physicianEAR"
destdir="\build\physicianEAR"/>
<wlpackage toDir="\physicianEAR\explodedphysicianEar" srcdir="\src\physicianEAR"
destdir="\build\physicianEAR" />