1

I have a requirement where i need to undeploy war files in weblogic using command 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 command 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

user1190615
  • 111
  • 1
  • 4
  • 17

4 Answers4

2

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.

Display Name is missing
  • 6,197
  • 3
  • 34
  • 46
  • Thanks Castling, but i wont get a app name, where i can directly parse it for undeployment. There would be a list with TaskID.... my requirement is to get app name – user1190615 Aug 04 '14 at 17:09
  • You could list and remove them all with WLST as well: http://wlstbyexamples.blogspot.com/2010/03/side-by-side-deployment-with-wlst.html#.U9_NRPldWLA Like COLINHY mentioned, it is a little unclear what you're doing – Display Name is missing Aug 04 '14 at 18:15
2

I 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()
user3632330
  • 58
  • 1
  • 5
1

The <name> should be the module name not the file (war or ear) name. Using the -undeploycommand without the -targets and -submoduletargets flags completely 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 complete 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).

COLINHY
  • 395
  • 1
  • 6
  • Yes Colinhy, I am aware of that but my requirement is to undeploy all the apps deployed in a server at a single go without giving the appdeployment name. as the app name changes for every deployment. – user1190615 Aug 04 '14 at 17:11
  • 1
    Then your question was not clear. In this case, you just simply added steps what have been described here :http://stackoverflow.com/questions/14499370/get-list-of-all-applications-deployed-on-a-weblogic-server – COLINHY Aug 04 '14 at 17:28
0

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()