![]() ![]() ![]() ![]() ![]() ![]() |
This tutorial describes how to use the WebLogic Scripting Tool (WLST) and the Administration Console to deploy the MedRec application to a server for production. In this example the application files are packaged in exploded format in directories, rather than as EAR files. The advantage of the exploded format for production is that deployment descriptor files in an exploded directory can be updated without having to be unarchived and then rearchived following the update.
For instructions on packaging the MedRec application into a single archived EAR file, in contrast to the exploded format used in this tutorial, see Tutorial 14: Packaging MedRec for Distribution. The advantage of packaging into an EAR file is that the application is more portable when bundled into a single file, and can more easily be moved or distributed.
The procedures below deploy the exploded contents of the medrecEar
, startBrowserEar
, physicianEar
, and initEar
subdirectories of the dist
directory, created in Tutorial 13: Compiling the Entire MedRec Project.
medrecEar
is MedRec's main enterprise application, containing its patient and administrative Web Applications, the Web Service used by the physician Web application, and the EJBs that store and run MedRec's logic and data. physicianEar
is a separate component of the MedRec application, with a different set of users, which communicates with medrecEar
using a Web Service.startBrowserEar
contains a single class file that starts the browser when the servlets in the Web Applications are initialized. initEar
contains an application that implements and registers a custom MBean that polls the database every 6 seconds, checking for new users that are added to the systemFor more information about the components of the MedRec application, see Overview of the Avitek Medical Records Development Tutorials.
Before starting this tutorial:
To deploy the MedRec applications for production:
See Step 1: Start the PointBase database.
StartPrograms
BEA Products
User Projects
MedRecDomain
Start Admin Server for WebLogic Server Domain
prompt> C:\bea\user_projects\domains\MedRecDomain\startWebLogic.cmd
To ensure that you start from a clean slate, use the Administration Console to delete the various MedRec applications that you might have deployed as part of the preceding tutorials:
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.tutorial_deployment
and wlpackage_tutorial
) by checking the box to the left of the application name.
The following procedure shows how to use the WebLogic Scripting Tool (WLST) to deploy medrecEar
to WebLogic Server for production.
The WebLogic Scripting Tool (WLST) is a command-line scripting interface that system administrators and operators use to monitor and manage WebLogic Server instances and domains. The WLST scripting environment is based on the Java scripting interpreter, Jython.
System administrators typically use WLST to:
WLST functionality also includes the capabilities of the WebLogic Server command-line utilities such as the wlconfig
Ant task and the weblogic.Deployer
utility. This procedure first describes how to create a Jython script that includes WLST commands, such as connect
and deploy
, and then how to create an Ant build file that invokes the WLST tool and passes it the Jython script file as an argument. You can also use WLST interactively, although this feature is not discussed in this tutorial.
prompt> c:\bea\user_projects\domains\medrecdomain\bin\setDomainEnv.cmd
medrecEar
subdirectory:prompt> cd c:\medrec_tutorial\src\medrecEar
deploy.py
; this file will contain the WLST commands. For example:prompt> notepad deploy.py
Note: | If you do not want to create the deploy.py file manually in this tutorial, copy the file named deploy_tutorial.py to a new file named deploy.py and follow along. |
deploy.py
file (substituting, if necessary, your actual MedRec project directory for c:\medrec_tutorial
); the WLST commands are described at the end of this step:userName = "weblogic"
passWord = "weblogic"
url="t3://localhost:7101"
connect(userName, passWord, url)
progress= deploy(
'medrecEar',
'c:\medrec_tutorial\dist\medrecEar',
targets='MedRecServer',
subModuleTargets='MedRecJMSServer@MedRecAppScopedJMS@MedRecJMSServer',
securityModel='CustomRolesAndPolicies' )
progress.printStatus()
disconnect()
exit()
The userName
, passWord
, and url
variables simply set up the value of the administration user, password, and the URL used to connect to the Administration Server. The connect
WLST command connects to the MedRecServer using these variables. The progress
variable captures a WLSTProgress
object that defines the status of the deployment. The deploy
command deploys the medrecEar
application. In addition to the standard options, such as the source (c:\medrec_tutorial\dist\medrecEar
) and deployment targets, the deploy command also specifies these additional options: subModuleTargets
to specify the sub-deployment level of the application-scoped JMS modules included in medrecEar
and securityModel
to specify that the medrecEar
application uses custom security roles and policies. Finally, the printStatus
method of the progress
variable prints out the status of the deployment. The disconnect
command closes the connection and the exit
command closes the scripting shell.
wlst_deploy.xml
. For example:prompt> notepad wlst_deploy.xml
Note: | If you do not want to create the wlst_deploy.xml file manually in this tutorial, copy the file named wlst_tutorial.xml to a new file named wlst_deploy.xml and follow along. |
wlst_deploy.xml
file by defining a project named wlst_tutorial
with a default target deploy
:<project name="wlst_tutorial" default="deploy">
arg
task to specify the deploy.py argument: <target name="deploy">
<java classname="weblogic.WLST" fork="yes">
<arg line="deploy.py" />
</java>
</target>
The Java classname of WLST is weblogic.WLST
, as specified by the classname
attribute of the java
task.
wlst_deploy.xml
file by closing the project element:</project>
<project name="wlst_tutorial" default="deploy">
<target name="deploy">
<java classname="weblogic.WLST" fork="yes">
<arg line="deploy.py" />
</java>
</target>
</project>
Save the file and exit your text editor.
prompt> ant -f wlst_deploy.xml
You should output similar to the following from WLST:
Buildfile: wlst_deploy.xml
deploy:
[java] Initializing WebLogic Scripting Tool (WLST) ...
[java] Welcome to WebLogic Server Administration Scripting Shell
[java] Type help() for help on available commands
[java] Connecting to t3://localhost:7101 with userid weblogic ...
[java] Successfully connected to Admin Server 'MedRecServer' that belongs to domain 'MedRecDomain'.
[java] Warning: An insecure protocol was used to connect to the
[java] server. To ensure on-the-wire security, the SSL port or
[java] Admin port should be used instead.
[java] Deploying application from c:\medrec_tutorial\dist\medrecEar to targets MedRecServer (upload=false) ...
[java] <Jul 24, 2006 4:15:08 PM PDT> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, medrecEar [archive: C:\medrec_tutorial\dist\medrecEar], to MedRecJMSServer MedRecServer .>
[java] .Completed the deployment of Application with status completed
[java] Current Status of your Deployment:
[java] Deployment command type: deploy
[java] Deployment State : completed
[java] Deployment Message : no message
[java] Current Status of your Deployment:
[java] Deployment command type: deploy
[java] Deployment State : completed
[java] Deployment Message : no message
[java] Disconnected from weblogic server: MedRecServer
[java] Exiting WebLogic Scripting Tool.
[java] <Jul 24, 2006 4:15:20 PM PDT> <Warning> <JNDI> <BEA-050001> <WLContext.close() was called in a different thread than the one in which it was created.>
BUILD SUCCESSFUL
Total time: 48 seconds
medrecEar
appears in the Deployments table and is in an Active
state. See the first few steps in Step 2: Delete the applications that have already been deployed. for details.Deploy the remaining MedRec applications to WebLogic Server as follows. See Step 2: Delete the applications that have already been deployed. for details on invoking the Administration Console in your browser.
C:\medrec_tutorial\dist
.physicianEar
and click Next. Install this deployment as an application
and click Next.Advanced: Use a custom model that you have configured on the realm's configuration page.
This choice ensures that you can use the Administration Console to configure custom security roles and policies for the deployment.
No, I will review the configuration later
in the Additional Configuration section.Review your other choices to ensure that all are correct. The Summary should look something like the following:
Deployment: C:\medrec_tutorial\dist\physicianEar
Name: physicianEar
Staging mode: Use the defaults defined by the chosen targets
Security Model: Advanced: Use a custom model that you have configured on the realm's configuration page.
2
through 10
to install the initEar
and startBrowserEar
applications.
As soon as MedRecServer starts the applications, the State column for each application in the Deployments table should say Active
.
You might also see the main MedRec informational page appear in your browser.
http://
host
:7101/physician
http://
host
:7101/patient
http://
host
:7101/admin
In the preceding URLs, host
refers to the computer that hosts MedRecServer
. If your browser is on the same computer as MedRecServer
, you can use localhost
; for example, http://localhost:7101/physician
.
You cannot do much more than look at the login pages right now, because these pages require security that you have not yet configured. This task is described in the next few tutorials.
weblogic.Deployer,
or Ant scripts that run deployment targets.
The split development directory framework allows you to deploy MedRec's compiled and generated files separately from the editable files. This capability is convenient during the development stage, when changes to the application are frequent. The expected format for production, however, is the traditional single-directory structure, with the separate applications in exploded format in separate subdirectories.
In this tutorial, you deployed MedRec's applications from directories that contained the applications and all of their components and support files. The applications' exploded format makes their editable files more accessible than they would be if they were bundled into archives.
Each application subdirectory in dist
contains both the compiled classes and generated deployment descriptors from the build
directory, and the editable deployment descriptors and other files from the src
directory.
![]() ![]() ![]() |