You can use WLST to quickly deploy an Application File in a Weblogic Server.
What do you need ?
What do you need ?
- The ear/war/rar/jar file ( uploaded to a directory in the target WebLogic Server )
- A simple WLST script
- Credentials for the Weblogic Server ( preferrably, 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', 'webl0gic', 't3://localhost:7001', adminServerName='AdminServer' )print 'stopping and undeploying ....'stopApplication('shoppingcart')print 'deploying....'deploy('shoppingcart', 'c:/shoppingcart.war', targets='AdminServer')startApplication('shoppingcart')print 'disconnecting from admin server....'disconnect()exit()print '*** WEBLOGIC : STOP ***'
- Open a Terminal Window / Command Prompt
- Run the setDomainEnv.sh ( or setDomainEnv.bat ) script to set the required environment variables under <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 undeploying ....
Stopping application shoppingcart.
<Oct 20, 2010 2:10:43 PM IST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiat
ing stop operation for application, shoppingcart [archive: null], to AdminServer
.>
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 c:\shoppingcart.war to targets AdminServer (upload=fa
lse) ...
<Oct 20, 2010 2:10:44 PM IST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiat
ing deploy operation for application, shoppingcart [archive: c:\shoppingcart.war
], to AdminServer .>
.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 shoppingcart.
<Oct 20, 2010 2:10:48 PM IST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiat
ing start operation for application, shoppingcart [archive: null], to AdminServe
r .>
.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.
<Oct 20, 2010 2:10:51 PM IST> <Warning> <JNDI> <BEA-050001> <WLContext.close() w
as called in a different thread than the one in which it was created.>
************************************************************************************************************
No comments:
Post a Comment