Advertisement

01.19.2008 at 01:26PM PST, ID: 23096048
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.0

I am getting error while running python script to create WebSphere 61 Environment.

Asked by Gurinders in Python Scripting Language, Miscellaneous Web Development, WebApplications

Tags: , , ,

I am trying to run the script but It ends with the following error. I am also pasting the script. Thanks.

Checking for the existence of a NodeSync MBean on node xxxxNode1

Invoking synchronization for node WebSphere:name=nodeSync,process=nodeagent,platform=common,node=dmq1Node01,diagnosticProvider=true,version=6.1.0.13,type=NodeSync,mbeanIdentifier=nodeSync,cell=dojaf1Cell01,spec=1.0 because serverStartupSyncEnabled is set to false...
Done with synchronization.

Invoking start for cluster xxxxxxxxxxxxxxx

Setting HTTP ports...
Setting HTTP port = 19210
WASX7017E: Exception received while running file "/tmp/scripts/configureOFSCDEV.py"; exception information: com.ibm.ws.scripting.ScriptingException: WASX7444E: Invalid parameter value "" for parameter "config id" on command "modify"

The command I am using to run the script

./wsadmin.sh -lang jython -conntype SOAP -port xxxxx -username xxxxxx -password xxxxxxx -f /tmp/scripts/config.py

#############################################
#
#  Python configuration script for Websphere
#
#  Prerequisites:
#
#  1) All nodes must be added with addNode.sh
#     prior to running this script
#
#  2) All desired configuration parameters
#     must be set in the configuration
#     section
#
#  Postrequisites:
#
#  1) Run setprops.py to set properties
#
#############################################

#############################################
# CONFIGURATION VARIABLES
#
# THESE VARIABLES MUST BE SET BEFORE
# EXECUTING THIS SCRIPT
#############################################

CELL = "xxxxxxxxxxx"
CLUSTER = "xxxxxxxxxxxx"
SERVER_PREFIX = "xxxxxxxxxx"
NODES = "Node1,Node1"
DEPLOYMENT_MANAGER = "dmgr"
START_PORT_HTTP = 19200       
START_PORT_HTTPS = 19440
SERVERS_PER_NODE = 1

#############################################
# DO NOT MODIFY BELOW THIS LINE
#############################################

import  java.lang.System  as  sys
lineSeparator = sys.getProperty('line.separator')

#############################################
# MAIN PROGRAM STARTS HERE
#############################################
 
def setPorts(server,index):
    print ""
    print "Setting HTTP ports..."
    wc = AdminConfig.list('WebContainer', server)
    transportsAttr = AdminConfig.showAttribute(wc, 'transports')
    transports = transportsAttr[1:len(transportsAttr)-1]
    transport = transports.split(" ")[0]
    print "Setting HTTP port = " + str(START_PORT_HTTP + (index * 10))
    AdminConfig.modify(transport, [['address', [['host', '*'], ['port', START_PORT_HTTP + (index * 10)]]]])
    transport = transports.split(" ")[1]
    print "Setting HTTPS port = " + str(START_PORT_HTTPS + (index * 10))
    AdminConfig.modify(transport, [['address', [['host', '*'], ['port', START_PORT_HTTPS + (index * 10)]]]])
    print "Done setting ports..."
   

#############################################
# Create a cluster within the cell
#############################################

# Check if cluster already exists
#      If not, create
#      If so, proceed

clusterList = AdminControl.completeObjectName("cell=" + CELL + ",type=Cluster,name=" + CLUSTER + ",*")

if len(clusterList) == 0:
  cellID = AdminConfig.getid("/Cell:" + CELL + "/")
  clusterName = "[[name " + CLUSTER + "]]"
  print ""
  print "Creating cluster " + CLUSTER + " in cell " + CELL
  AdminConfig.create('ServerCluster', cellID, clusterName)
else:
  print ""
  print "Cluster " + CLUSTER + " already exists, proceeding."

############################################
# Add Application Servers to the cluster
############################################

print ""
print "Creating application server(s) in cluster " + CLUSTER
clusterID = AdminConfig.getid("/ServerCluster:" + CLUSTER + "/")

nodeList = NODES.split(",")
index = 1
for nodeName in nodeList:
   node = AdminConfig.getid("/Node:" + nodeName + "/")
   loop = 0
   while (loop != SERVERS_PER_NODE):
      uid = "%s" % (index)
      servName = SERVER_PREFIX + uid
      serverID = AdminConfig.getid('/Server:' + servName + '/')
      if len(serverID) == 0:
         nameAttr = ["memberName", servName]
         attrs = []
         attrs.append(nameAttr)
         print "Creating server " + servName + " on node " + nodeName
         server = AdminConfig.createClusterMember(clusterID, node, attrs)
      else:
         print "Server " + servName + " already exists, proceeding."

      loop = loop + 1
      index = index + 1

   ###########################################
   # Save and sync changes
   ###########################################
   print "Saving configuration..."
   AdminConfig.save()
   print " "
   print " "

####################################################
# Ask the ClusterMgr to refresh its list of clusters
####################################################

clusterMgr = AdminControl.completeObjectName("type=ClusterMgr,cell=" + CELL + ",*")
if len(clusterMgr) == 0:
   print "Error -- clusterMgr MBean not found for cell " + CELL
else:
   AdminControl.invoke(clusterMgr, "retrieveClusters")

##########################################################
# For each node, invoke a sync if necessary
#     -- Is a nodeSync MBean available on this node?
#     -- Find out if serverStartupSyncEnabled is true for this node
#        We just created this server, so if this attribute is set to
#        "false" we have to perform a sync.  If we do not, the node we
#        are installing on may have an out-of-date copy of the config
#        data.
##########################################################
for nodeName in nodeList:
   node = AdminConfig.getid("/Node:" + nodeName + "/")
   print ""
   print "Checking for the existence of a NodeSync MBean on node " + nodeName
   nodeSync = AdminControl.completeObjectName("type=NodeSync,node=" + nodeName + ",*")
   if len(nodeSync) == 0:
      print "Error -- NodeSync MBean not found for name " + nodeName
   else:
      enabled = AdminControl.getAttribute(nodeSync, "serverStartupSyncEnabled")
      if enabled == "false":
         print ""
         print "Invoking synchronization for node " + nodeSync + " because serverStartupSyncEnabled is set to false..."
         AdminControl.invoke(nodeSync, "sync")
         sleep(20)
         print "Done with synchronization."
 
##########################################################
# Ask the Cluster MBean to start the cluster
##########################################################
cluster = AdminControl.completeObjectName("type=Cluster,name=" + CLUSTER + ",*")
print ""
print "Invoking start for cluster " + CLUSTER
AdminControl.invoke(cluster, "start")
sleep(30)

##########################################################
# Set the ports
##########################################################

nodeList = NODES.split(",")
index = 1
for nodeName in nodeList:
   node = AdminConfig.getid("/Node:" + nodeName + "/")
   loop = 0
   while (loop != SERVERS_PER_NODE):
      uid = "%s" % (index)
      sid = loop + 1
      servName = SERVER_PREFIX + uid
      #servName = SERVER_PREFIX + 'n' + repr(index) + 's' + repr(sid) + SERVER_SUFFIX
      serverID = AdminConfig.getid('/Server:' + servName + '/')
      setPorts(serverID,index)

      loop = loop + 1
      index = index + 1

   ###########################################
   # Save and sync changes
   ###########################################
   print "Saving configuration..."
   AdminConfig.save()
   print " "
   print " "

##########################################################
# Regenerate the Websphere plugin file
##########################################################
print ""
print "Regenerating the plugin-cfg.xml files..."
nodeList = NODES.split(",")
for nodeName in nodeList:
   node = AdminConfig.getid("/Node:" + nodeName + "/")
   pluginGen = AdminControl.completeObjectName('type=PluginCfgGenerator,*')
   AdminControl.invoke(pluginGen, 'generate', "/opt/WebSphere61/AppServer/profiles/Dmgr01/config" + CELL + " null null plugin-cfg.xml")

##########################################################
# Ask the Cluster MBean to restart the cluster
##########################################################
cluster = AdminControl.completeObjectName("type=Cluster,name=" + CLUSTER + ",*")
print ""
print "Restarting cluster " + CLUSTER
AdminControl.invoke(cluster, "stop")
sleep(30)
AdminControl.invoke(cluster, "start")
sleep(30)

print "***********************************************************************"
print "Cluster successfully created. Please run setprops.py to set properties."
print "***********************************************************************"
Start Free Trial
 
 
[+][-]01.22.2008 at 05:11AM PST, ID: 20713823

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Python Scripting Language, Miscellaneous Web Development, WebApplications
Tags: Scripting, Python, Ibm WebSphere, WAS61
Sign Up Now!
Solution Provided By: giltjr
Participating Experts: 2
Solution Grade: B
 
 
[+][-]01.28.2008 at 06:22AM PST, ID: 20759082

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05.09.2008 at 11:08AM PDT, ID: 21535212

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.09.2008 at 11:50AM PDT, ID: 21535498

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_EXPERT_20070906