Professional Documents
Culture Documents
gowroju asked on 5/19/2011
#---------------------------------------------------------
# Save all the changes
#---------------------------------------------------------
print "Deploy: saving the configuration"
AdminConfig.save()
sleep(20)
#----------------------------------------------------------------------
# check if the application is ready to start. If ready then start it
#------------------------------------------------------------------------
def startAppOnServer():
appready = AdminApp.isAppReady(appName)
print appready
if appready == 'false':
sleep(40)
appready = AdminApp.isAppReady(appName)
print appready
else:
print "starting the application "+appName+" on "+serverName+" "
appManager = AdminControl.queryNames("type=ApplicationManager,process="+ serverName +",*")
if appManager == "":
print "Please make sure whether Application Server is up and running before starting the applicaiton "
print " Or There could be something wrong with installated EAR file "
AdminControl.invoke(appManager, 'startApplication', appName)
appstate = AdminControl.completeObjectName("type=Application,name="+appName+",*")
if appstate != "":
print ""+ appName +" started "
# ----------------------------------------------------------------------------------------------------------------------------
# This function verifies whether Application is already deployed or not. If already deployed it will be uninstalled first
# -----------------------------------------------------------------------------------------------------------------------------
def appexist():
print " checking for the "+appName+" applicaiton whether it is already exists or not"
apps = AdminApp.list().split(lineSeparator)
for applist in apps:
if applist == appName:
print "Application is already installed so It will be uninstalled first "
AdminApp.uninstall(appName)
AdminConfig.save()
else:
print " ------------------------------------------------"
print " "+appName+" doesn't exists now so it will be deployed "
#----------------------------------------------------------------------------------------
#Main codes start here....
# ----------------------------------------------------------------------------------------
if (len(sys.argv) !=7):
print " Please enter correct arguments "
print " ex: DeployEAROnServer.py /usr/IBM/AppServer/installableApps/sample.ear sample mynode server1 virtualHost webserverNode
webserver"
else:
earlocation = sys.argv[0]
appName = sys.argv[1]
nodeName = sys.argv[2]
serverName = sys.argv[3]
virtualHost = sys.argv[4]
webNode1 = sys.argv[5]
webSrv1 = sys.argv[6]
print "EARfilelocation :" +earlocation
print "Application Name : " +appName
print "Node Name : " +nodeName
print "Server Name : " +serverName
print "Virtual Host :" +virtualHost
print "WebServerNode :" +webNode1
print "WebServer : " +webSrv1
appexist()
DeployOnServer(earlocation, appName, nodeName, serverName, virtualHost, webNode1, webSrv1)
execfile('/usr/IBM/WebSphere/wasadm/scripts/jython/syncNode.py')
startAppOnServer()
Python
Last Comment
19 1 HonorGod 8/22/2022
5/19/2011
gowroju ASKER
mapping of modules to server in the sense its getting mapped to appserver node but not webserver node probably what might be the reason and if
anything i needs to add there let me know....
HonorGod
5/19/2011
5/19/2011
gowroju ASKER
defapp = earlocation
O 1 "W bS h ll " llN " d " d N " " N
servOpt1 = "WebSphere:cell=" + cellName + ",node=" + nodeName + ",server=" + serverName
servOpt2 = "+WebSphere:cell=" + cellName + ",node=" + webNode1 + ",server=" + webSrv1
servOpt = servOpt1+servOpt2
this is the statement which we are passing to map the modules to the appserver node and webserver node...
5/19/2011
gowroju ASKER
acutally we are giving some arguements while running this script script is sucessfully getting deployed but the thing is in manage modules we are missing
the webserver parameter....do i need to change anything or else..what i need to do....or else i need to add any statement in the script
William Peck
5/19/2011
HonorGod
It is very hard to get a good understanding of your code by looking at these snippets.
Unless you are using WebSphere XD, which supports multiple cells, then the cell=<cellName> shouldn't be needed either.
I would use the Admin Console to deploy your application, then use an interactive wsadmin environment to display the MapModulesToServers section of
the deployed application to see the syntax that is expected and being used. Then, you would be much more likely to satisfy the deployment expectations
with your script.
5/19/2011
gowroju ASKER
yeah we can do like that but , this script is running fyn for some applications and it is creating a proble with few application .. i am not sure whether it is
with script issue or else console issue.....
5/19/2011
HonorGod
Thanks!
5/19/2011
gowroju ASKER
the scripting is running successfully with out any errors on various versions...but the thing is that mapping of modules to server...is the issue...usually while
deploying we will select some manage modules right , while selecting manage modules ( one AppNode and webNode we will be selecting ) when we are
doing it from console ...but while in script we are mapping those two but webnode is failing in the sense i am unable to see in the console , the map of
webserver to the module.....where as appNode is mapped properly to server.
5/19/2011
HonorGod
And the value you are specifying for the mapping of modules to server in the Jython code matches what you see in Jython when you use code like this?
1: print AdminApp.view( appName, '-MapModulesToServers' )
5/20/2011
gowroju ASKER
Specify targets such as application servers or clusters of application servers where you want to install the modules that are contained in your application.
Modules can be installed on the same application server or dispersed among several application servers.
Also, specify the Web servers as targets that serve as routers for requests to this application.
The plug-in configuration file (plugin-cfg.xml) for each Web server is generated, based on the applications that are routed through.
Module: provWebApp
URI: provWebApp.war,WEB-INF/web.xml
Server: WebSphere:cell=JFSDEVDMGRCell,node=JFSDEVNode02,server=ccidsportal_dev_srv2
Here is the thing which i am seeing in running script could you suggest do i need to add anything in the servOpt...
fblack61
5/20/2011
gowroju ASKER
Thanks a lot guys working on my issue finally the issue got resolved
5/20/2011
HonorGod
Cool. What did they do, and how did they do it?
5/20/2011
gowroju ASKER
actually i have obsorbed the script very clearly four -five times
appOptions = []
appOptions.extend(nameOpt)
appOptions.extend(nodeOpt)
appOptions.extend(serverOpt1)
appOptions.extend(mapVhOpt)
print appOptions
by observing to this and searching in the google i found out the error we have to give like this
appOptions.extend(server) in place of appOptions.extend(serverOpt1). then it worked out fine ...Actually our target is not mapping to server, it is
mapping to serverOpt1..thats why it is mapping to only appserver node...
5/20/2011
HonorGod
Ah ha! That would have been very difficult for me to identify. Thanks for sharing the details.
6/6/2011
HonorGod
12/3/2013
ques4web
Hi Gowroju,
I don't the server variable that you have defined in your script. But I do see serverOpt1 and serverOpt2. How it is working when you passed server as
parameter?
Walt Forbes
12/3/2013
ques4web
5/16/2018
Minh Nguyen Van
Hi guys,
Now like I done as shown in the screenshot ( attached file)but it was done by manually. How Could we script for that archiving?
ModuleMappingPNG.PNG
5/16/2018
HonorGod
Minh Nguyen Van - If you want someone to respond, ask a new question.