Hi,

Jay SenSharma

Jay SenSharma

If we have many Application, all of them should be deployed to WebLogic Server then It’s very unconvenient to deploy these Applications using Admin Console one by one.

Here we have a Simplest WLST script developed by “Ms. Tasleem Shaikh”, which is able to do this combersome job for us by a Single Enter Key Press…

Step1). First of all Place all the Applications in a perticular Directory:
Example: C:DELETEWLST_Deploy_Test
I have placed three Applications inside this Directory:
1). “Web5” Which is an Exploded WebApplication
2). “SessionTest.war” Which is An Archived WebApplication
3). “ejb20_basic_statelessSession.jar” is an Archived StatelessSession Bean 2.x Appication

Step2). Now Create a Text File “applicationsList.txt” (File Name may be any thing) which should contain All the Deployable File/Folder names like below:

“applicationsList.txt”
————————–
Web5
SessionTest.war
ejb20_basic_statelessSession.jar
————————–

Step3). Now run the following WLST script to deploy all these applications one by one on WebLogic Server.

“deployRecursively.py”

connect('weblogic','weblogic','t3://localhost:7001')
target='AdminServer'

f = open(r'./applicationsList.txt','r')
#In Above line you can specify the Complete Path of the “applications.txt” as well

print f
for i in range(3):
       line=f.readline()
       line1=line[:-1]
       appName='./'+line1
       print '*****************'+appName
       edit()
       startEdit()
       deploy(appName=line1,path=appName, targets=target)
       save()
       activate()
       f.close()

Step 4). Now open a command Window and run either “setWLSEnv.cmd” or “setDomainEnv.cmd” then then type the following comand to run the “deployRecursively.py” script:

C:DELETEWLST_Deploy_Test> java weblogic.WLST deployRecursively.py

NOTE A): In the Above script the
for i in range(3)    <——- here range(3) indicates that we are going to deploy Three Applications.

NOTE B): In place of the following relative path :
f = open(r’./applicationsList.txt’,’r’)
you can specify the Absolute path of “applicationsList” as well.

NOTE C): If you want to deploy your Application to a Cluster then Specify the target name as the Cluster Name.

target=’AdminServer’ (To Deploy Applications to AdminServer Only)
target=’ClusterA’ (To Deploy Applications to ClusterA Only)

Special Thanks to “Ms. Tasleem Shaikh” for developing this Great TimeSaving WLST Script.

If you enjoyed this post, please considerleaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.