Вы находитесь на странице: 1из 3

Deployment in Weblogic9.

x using WLST

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. You
can use the scripting tool online (connected to a running Administration Server or Managed
Server instance) and offline (not connected to a running server).Commands for
deployment/undeployment can only be executed on online mode.

Below are the steps to deploy/redeploy/undeploy applications in weblogic server using WLST.

1) Invoke WLST using the below command-


java weblogic.WLST

You need to run weblogic environment set up script, setWLSEnv.sh, If you see the below error
Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/WLST

The following messages are displayed if it’s successfully invoked.

Initializing WebLogic Scripting Tool (WLST) ...


Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands

2) Execute the below command for connecting to weblogic admin server and to make WLST
online.
connect ('<AdminServerUserName>','<AdminServerPassword>','<URL>');
Replace <AdminServerUserName> / <AdminServerPassword> with the weblogic admin user
name/password in the above command. <URL> consists the listen address and listen port of the
admin server instance, specified using the following format: [protocol://]listen-address:listen-port
For example, below is the command for connecting to weblogic server in test environment.

connect('pricetst','pricetst','t3://hvdnt44a.dev.qintra.com:20010')

The following messages are displayed if it’s successfully connected.

Connecting to t3://hvdnt44a.dev.qintra.com:20010 with userid pricetst ...


Successfully connected to Admin Server 'pricing' that belongs to domain 'wls704'.

Note: Make sure that the server is up and running before trying to connect. The above two steps
are to be executed before running any of the below deploy/redeploy/undeploy commands.

3) Use the below command for deploying an application.

progress=deploy(appName='<ApplicationName>', path=’<PathToWarFile>’, targets='<target


managed server>')
-where you need to pass application name, its path and the weblogic target managed server as
arguments.

For example, below is the command for deploying ‘ips0’ application in the test environment.

Eg: deploy(appName='ips0', path='/proj/pricing/wls922/tmp/ips0.war', targets='ips0')

The following messages are displayed after successful deployment.

Deploying application from /proj/pricing/wls922/tmp/ips0.war to targets ips0 (upload=false) ...


<Nov 12, 2008 7:22:21 AM EST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating
deploy operation for application, ips0 [archive: /proj/pricing/wls922/tmp/ips0.war], to ips0 .>
.Completed the deployment of Application with status completed
Current Status of your Deployment:
Deployment command type: deploy
Deployment State : completed
Deployment Message : no message

If the deployment is not successful, execute dumpStack() function to know the root cause.
dumpStack() displays stack trace from the last exception that occurred while performing a WLST
action, and reset the stack trace.
4) Use the below command for redeploying an already running application.

redeploy(appName='<ApplicationName>', path=’<PathToWarFile>’, targets='<target managed


server>')

The same set of arguments (mentioned in the 4th step) are to be provided here as well.

Eg: progress=redeploy(appName='ips0', path=’/proj/pricing/wls922/tmp/ips0.war’, targets='ips0')

The following messages are displayed after successful re-deployment.

Redeploying application ips0 ...


<Dec 4, 2008 6:22:54 AM EST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating
redeploy operation for application, ips0 [archive: null], to ips0 .>
.....Completed the redeployment of Application with status completed
Current Status of your Deployment:
Deployment command type: redeploy
Deployment State : completed
Deployment Message : no message

5) Use the below command for undeploying an application.

undeploy('<ApplicationName>'); which takes application names like ‘test’,’ips0’ etc.

For example, below is the command for undeploying ‘ips0’ application.


undeploy(‘ips0’)

The following messages are displayed after successful undeployment.

Undeploying application ips0 ...


<Dec 3, 2008 6:59:38 AM EST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating
undeploy operation for application, ips0 [archive: null], to ips0 .>
.Completed the undeployment of Application with status completed
Current Status of your Deployment:
Deployment command type: undeploy
Deployment State : completed
Deployment Message : no message

6) The below command disconnects WLST from a WebLogic Server instance.

disconnect()
The disconnect command does not cause WLST to exit the interactive scripting shell; it closes the
current WebLogic Server instance connection and resets all the variables while keeping the
interactive shell alive.

7) Please use the below command for exiting from WLST.

exit()

Note:

The deployment/redeployment steps mentioned above would also make the applications in active
state. So a different activation process is not required. You may log into admin console- (for test
environment-http://hvdnt44a.dev.qintra.com:20010/console) and verify the deployment status if
required.

Links:

Please click this link for more details about WLST


-http://edocs.bea.com/wls/docs91/config_scripting/using_WLST.html#1078852
For more details about WLST commands-
http://edocs.bea.com/wls/docs91/config_scripting/reference.html#1005383