A quick tutorial for middleware products

Saturday, November 22, 2014

On November 22, 2014 by Kamlesh   2 comments

How to Deploy Application using WLST


We can use WLST to quickly deploy an Application in a Weblogic Server.

Requirement:-
·The ear/war/rar/jar file (uploaded to a directory in the target WebLogic Server )
·A simple WLST script
·Credentials for the Weblogic Server (preferably, the weblogic user).

·Write a simple WLST Script to do your work and save it as "deploy.py"

print  WEBLOGIC : START
print 'connecting to admin server....'
connect( 'weblogic', 'weblogic', 't3://localhost:7001', adminServerName='AdminServer' )
print 'stopping and undeploying ....'
stopApplication('application')
print 'deploying....'
deploy('shoppingcart', 'c:/application.war', targets='AdminServer')
startApplication('application')
print 'disconnecting from admin server....'
disconnect()
exit()
print  WEBLOGIC : STOP

·Open a Terminal Window / Command Prompt
·Run the setDomainEnv.sh/ setDomainEnv.bat script to set the required environment variables under <weblogic domain>/bin.
·run :-  java weblogic.WLST deploy.py
 output -
 java weblogic.WLST sc
ript.py
Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

*** WEBLOGIC : START ***
connecting to admin server....
Connecting to t3://localhost:7001 with userid weblogic ...
Successfully connected to Admin Server 'AdminServer' that belongs to domain 'bas
e_domain'.

Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.

stopping and underplaying ....
Stopping application………….

Completed the stop of Application with status completed
Current Status of your Deployment:
Deployment command type: stop
Deployment State       : completed
Deployment Message     : no message
Deploying....
Deploying application from D:\application.war to targets AdminServer (upload=fa
lse) ...
Completed the deployment of Application with status completed
Current Status of your Deployment:
Deployment command type: deploy
Deployment State       : completed
Deployment Message     : no message
Starting application……….
Completed the start of Application with status completed
Current Status of your Deployment:
Deployment command type: start
Deployment State       : completed
Deployment Message     : no message
disconnecting from admin server....
Disconnected from weblogic server: AdminServer

Exiting WebLogic Scripting Tool.

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Excellent post, it helped me to overcome an issue.
    Keep up the good work.

    ReplyDelete