I have a requirement where i need to undeploy war files in weblogic using mand line, the below code does it for me :
java weblogic.Deployer -adminurl t3://localhost:8001 -user weblogic -password password123 -name <name> -undeploy
But the file names change after every deployment, i,e (file 1.0.0 and file 1.1.1).
i need a mand in such a way so that it undeploys all the files present in that server.
can any body let me know how to undeploy all files at a single go ?
Thanks in advance,
Vishal
I have a requirement where i need to undeploy war files in weblogic using mand line, the below code does it for me :
java weblogic.Deployer -adminurl t3://localhost:8001 -user weblogic -password password123 -name <name> -undeploy
But the file names change after every deployment, i,e (file 1.0.0 and file 1.1.1).
i need a mand in such a way so that it undeploys all the files present in that server.
can any body let me know how to undeploy all files at a single go ?
Thanks in advance,
Vishal
Share Improve this question asked Aug 3, 2014 at 16:28 user1190615user1190615 1111 gold badge4 silver badges17 bronze badges4 Answers
Reset to default 2I have found out how to undeploy all the apps :
List Apps:
import sys
connect('weblogic','weblogic10','http://autowfm-vmh:7259')
cd("AppDeployments")
app = ls(returnMap='true')
domainRuntime()
cd("AppRuntimeStateRuntime/AppRuntimeStateRuntime")
i=1
f = open('filename.txt','w')
for appName in app:
print >>f, appName
i=i+1
f.close()
exit()
Undeploy :
import os
connect('weblogic','weblogic','http://localhost:7001')
target='AdminServer'
f = open(r'D:\filename.txt','r')
print f
for i in range(10):
line=f.readline()
line1=line[:-1]
appName='./'+line1
print '*****************'+appName
undeploy(appName=line1)
exit()
If you want to script a more generic answer you can list all the apps via:
java -cp /opt/ora/mw/wlserver_10.3/server/lib/weblogic.jar weblogic.Deployer
-adminurl t3://host:port -username weblogic -password weblogic1 -listapps
And then parse that output to begin removing apps.
The <name>
should be the module name not the file (war or ear) name. Using the -undeploy
mand without the -targets
and -submoduletargets
flags pletely removes the application or standalone module from all WebLogic Server instances and untargets all JMS sub-module resources.
BTW, Adding the -graceful
option would allow current HTTP clients to plete their work before undeploying.
Note: Undeploying a deployment unit does not remove the original source files used for deployment. It only removes the deployment's configuration from the domain, as well as any deployment files that WebLogic Server created during deployment (for example, files copied with stage deployment mode and files uploaded to the Administration Server).
I have found out how to undeploy all the apps without using files
def undeployWars():
cd("AppDeployments")
namesWars = ls(returnMap='true')
for nameWar in namesWars:
undeploy(nameWar)
connect('weblogic', 'weblogic01', 't3://localhost:7001')
undeployWars()
disconnect()
exit()