Setting port numbers to the serverindex.xml file using scripting

You can use the wsadmin tool to modify the port numbers specified in the serverindex.xml file. The endpoints of the serverindex.xml file are part of different objects in the configuration.

About this task

There are multiple ways to complete this task. Complete the steps in this task to use the AdminConfig and AdminTask objects to configure ports in your environment. Alternatively, you can use the scripts in the AdminServerManagement script library to configure various ports in your configuration.

Before modifying ports using scripting, you must launch the wsadmin tool.

Procedure

  • Modify the BOOTSTRAP_ADDRESS attribute of the server1 process.

    The BOOTSTRAP_ADDRESS attribute is an attribute of the NameServer object that exists inside the server. The naming client uses the attribute to specify the naming server to look up the initial context. The following examples demonstrate how to modify the BOOTSTRAP_ADDRESS attribute:

    • Using the AdminTask object:
      • Using Jacl:
        $AdminTask modifyServerPort server1 {-nodeName mynode -endPointName BOOTSTRAP_ADDRESS 
        -host myhost -port 2810}
      • Using Jython:
        AdminTask.modifyServerPort ('server1', '[-nodeName mynode -endPointName 
        BOOTSTRAP_ADDRESS -host myhost -port 2810]')
    • Using the AdminConfig object. To modify its endpoint, obtain the ID of the NameServer object and issue a modify command, as the following example demonstrates:
      • Using Jacl:
        set s [$AdminConfig getid /Cell:mycell/Node:mynode/Server:server1/]
        set ns [$AdminConfig list NameServer $s]
        $AdminConfig modify $ns {{BOOTSTRAP_ADDRESS {{port 2810} {host myhost}}}}
      • Using Jython:
        s = AdminConfig.getid('/Cell:mycell/Node:mynode/Server:server1/')
        ns = AdminConfig.list('NameServer', s)
        AdminConfig.modify(ns, [['BOOTSTRAP_ADDRESS', [['host', 'myhost'],  ['port', 2810]]]])
  • Modify the SOAP_CONNECTOR-ADDRESS attribute of the server1 process.

    The SOAP_CONNECTOR-ADDRESS attribute is an attribute of the SOAPConnector object that exists inside the server. HTTP transport uses the SOAP connector port for incoming SOAP requests. Use the following examples modify the SOAP_CONNECTOR-ADDRESS attribute:

    • Using the AdminTask object:
      • Using Jacl:
        $AdminTask modifyServerPort server1 {-nodeName mynode -endPointName SOAP_CONNECTOR_ADDRESS 
        -host myhost -port 8881}
      • Using Jython:
        AdminTask.modifyServerPort ('server1', '[-nodeName mynode -endPointName SOAP_CONNECTOR_ADDRESS 
        -host myhost -port 8881]')
    • To use the AdminConfig object to modify its endpoint, obtain the ID of the SOAPConnector object and issue a modify command, as the following example demonstrates:
      • Using Jacl:
        set s [$AdminConfig getid /Cell:mycell/Node:mynode/Server:server1/]
        set soap [$AdminConfig list SOAPConnector $s]
        $AdminConfig modify $soap {{SOAP_CONNECTOR_ADDRESS {{host myhost} {port 8881}}}}
      • Using Jython:
        s = AdminConfig.getid('/Cell:mycell/Node:mynode/Server:server1/')
        soap = AdminConfig.list('SOAPConnector', s)
        AdminConfig.modify(soap, [['SOAP_CONNECTOR_ADDRESS', [['host', 'myhost'],  ['port', 8881]]]])
  • Modify the JMSSERVER_QUEUED_ADDRESS and JMSSERVER_DIRECT_ADDRESS attributes of the server1 process.

    The JMSSERVER_QUEUED_ADDRESS and JMSSERVER_DIRECT_ADDRESS attributes are attributes of the JMSServer object that exists inside the server. The system uses these ports to configure the JMS provider topic connection factory settings. The following examples modify the JMSSERVER_QUEUED_ADDRESS and JMSSERVER_DIRECT_ADDRESS attributes:

    • Using the AdminTask object:
      • Using Jacl:
        $AdminTask modifyServerPort server1 {-nodeName mynode -endPointName JMSSERVER_QUEUED_ADDRESS 
        -host myhost -port 5560}
        
        $AdminTask modifyServerPort server1 {-nodeName mynode -endPointName JMSSERVER_DIRECT_ADDRESS 
        -host myhost -port 5561}
      • Using Jython:
        AdminTask.modifyServerPort ('server1', '[-nodeName mynode -endPointName JMSSERVER_QUEUED_ADDRESS 
        -host myhost -port 5560]')
        
        AdminTask.modifyServerPort ('server1', '[-nodeName mynode -endPointName JMSSERVER_DIRECT_ADDRESS 
        -host myhost -port 5561]')
    • Using the AdminConfig object. To modify its endpoint, obtain the ID of the JMSServer object and issue a modify command, for example:
      • Using Jacl:
        set s [$AdminConfig getid /Cell:mycell/Node:mynode/Server:server1/]
        set jmss [$AdminConfig list JMSServer $s]
        $AdminConfig modify $jmss {{JMSSERVER_QUEUED_ADDRESS {{host myhost} {port 5560}}}}
        $AdminConfig modify $jmss {{JMSSERVER_DIRECT_ADDRESS {{host myhost} {port 5561}}}}
      • Using Jython:
        s = AdminConfig.getid('/Cell:mycell/Node:mynode/Server:server1/')
        jmss = AdminConfig.list('JMSServer', s)
        AdminConfig.modify(jmss, [['JMSSERVER_QUEUED_ADDRESS', [['host', 'myhost'], ['port', 5560]]]])
        AdminConfig.modify(jmss, [['JMSSERVER_DIRECT_ADDRESS', [['host', 'myhost'], ['port', 5561]]]])
  • Modify the NODE_DISCOVERY_ADDRESS attribute of node agent process.
    The NODE_DISCOVERY_ADDRESS attribute is an attribute of the NodeAgent object that exists inside the server. The system uses this port to receive the incoming process discovery messages inside a node agent process. The following examples modify the NODE_DISCOVERY_ADDRESS attribute:
    • Using the AdminTask object:
      • Using Jacl:
        $AdminTask modifyServerPort nodeagent {-nodeName mynode -endPointName 
        NODE_DISCOVERY_ADDRESS -host myhost -port 7272}
      • Using Jython:
        AdminTask.modifyServerPort ('nodeagent', '[-nodeName mynode -endPointName 
        NODE_DISCOVERY_ADDRESS -host myhost -port 7272]')
    • Using the AdminConfig object. To modify its endpoint, obtain the ID of the NodeAgent object and issue a modify command, for example:
      • Using Jacl:
        set nodeAgentServer [$AdminConfig getid /Cell:mycell/Node:mynode/Server:nodeagent/]
        set nodeAgent [$AdminConfig list NodeAgent $nodeAgentServer]
        $AdminConfig modify $nodeAgent {{NODE_DISCOVERY_ADDRESS {{host myhost} {port 7272}}}}
      • Using Jython:
        nodeAgentServer = AdminConfig.getid('/Cell:mycell/Node:mynode/Server:nodeagent/')
        nodeAgent = AdminConfig.list('NodeAgent', nodeAgentServer)
        AdminConfig.modify(nodeAgent, [['NODE_DISCOVERY_ADDRESS', [['host', 'myhost'], ['port', 7272]]]])
  • Modify the CELL_DISCOVERY_ADDRESS attribute of deployment manager process.
    The CELL_DISCOVERY_ADDRESS attribute is an attribute of the deploymentManager object that exists inside the server. The system uses this port to receive the incoming process discovery messages inside a deployment manager process. Use the following examples modify the CELL_DISCOVERY_ADDRESS attribute:
    • Using the AdminTask object:
      • Using Jacl:
        $AdminTask modifyServerPort dmgr {-nodeName managernode -endPointName 
        CELL_MULTICAST_DISCOVERY_ADDRESS -host myhost -port 7272}
        
        $AdminTask modifyServerPort dmgr {-nodeName managernode -endPointName 
        CELL_DISCOVERY_ADDRESS -host myhost -port 7278}
      • Using Jython:
        AdminTask.modifyServerPort ('dmgr', '[-nodeName managernode -endPointName 
        CELL_MULTICAST_DISCOVERY_ADDRESS -host myhost -port 7272]')
        
        AdminTask.modifyServerPort ('dmgr', '[-nodeName managernode -endPointName 
        CELL_DISCOVERY_ADDRESS -host myhost -port 7278]')
    • To use the AdminConfig attribute to modify its endpoint, obtain the ID of the deploymentManager object and issue a modify command, for example:
      • Using Jacl:
        set netmgr [$AdminConfig getid /Cell:mycell/Node:managernode/Server:dmgr/]
        set deploymentManager [$AdminConfig list CellManager $netmgr]
        $AdminConfig modify $deploymentManager {{CELL_MULTICAST_DISCOVERY_ADDRESS {{host myhost} {port 7272}}}} 
        $AdminConfig modify $deploymentManager {{CELL_DISCOVERY_ADDRESS {{host myhost} {port 7278}}}}
      • Using Jython:
        netmgr = AdminConfig.getid('/Cell:mycell/Node:managernode/Server:dmgr/')
        deploymentManager = AdminConfig.list('CellManager', netmgr)
        AdminConfig.modify(deploymentManager, [['CELL_MULTICAST_DISCOVERY_ADDRESS', [['host', 'myhost'],  
        ['port', 7272]]]]) 
        AdminConfig.modify(deploymentManager, [['CELL_DISCOVERY_ADDRESS', [['host', 'myhost'], ['port', 7278]]]])
  • Modify the WC_defaulthost attribute of the server1 process.
    Use the following examples modify WC_defaulthost endpoint:
    • Using the AdminConfig object:
      • Using Jacl:
        set serverName server1
        set node [$AdminConfig getid /Node:myNode/]
        set serverEntries [$AdminConfig list ServerEntry $node]
        
        foreach serverEntry $serverEntries {
          set sName [$AdminConfig showAttribute $serverEntry serverName]
          if {$sName == $serverName} {
             set specialEndPoints [lindex [$AdminConfig showAttribute $serverEntry specialEndpoints] 0]
             foreach specialEndPoint $specialEndPoints {
                set endPointNm [$AdminConfig showAttribute $specialEndPoint endPointName]
                if {$endPointNm == "WC_defaulthost"} {
                   set ePoint [$AdminConfig showAttribute $specialEndPoint endPoint]
                   $AdminConfig modify $ePoint [list [list host myhost] [list port 5555]]
                   break
                } 
             }
          }
        }
      • Using Jython:
        serverName = "server1"
        node = AdminConfig.getid('/Node:myNode/')
        serverEntries = AdminConfig.list('ServerEntry', node).split(java.lang.System.getProperty('line.separator'))
        
        for serverEntry in serverEntries:
          sName = AdminConfig.showAttribute(serverEntry, "serverName")
          if sName == serverName:
             sepString = AdminConfig.showAttribute(serverEntry, "specialEndpoints")
             sepList = sepString[1:len(sepString)-1].split(" ")
             for specialEndPoint in sepList:
                endPointNm = AdminConfig.showAttribute(specialEndPoint, "endPointName")
                if endPointNm == "WC_defaulthost":
                   ePoint = AdminConfig.showAttribute(specialEndPoint, "endPoint")
                   AdminConfig.modify(ePoint, [["host", "myhost"], ["port", 5555]])
                   break
        
  • Modify the WC_defaulthost_secure attribute of the server1 process.
    Use the following examples to modify a WC_defaulthost_secure endpoint:
    • Using the AdminTask object:
      • Using Jacl:
        $AdminTask modifyServerPort server1 {-nodeName myNode -endPointName WC_defaulthost_secure 
        -host myhost -port 5544}
      • Using Jython:
        AdminTask.modifyServerPort ('server1', '[-nodeName myNode -endPointName WC_defaulthost_secure 
        -host myhost -port 5544]')
    • Using the AdminConfig object:
      • Using Jacl:
        set serverName server1
        set node [$AdminConfig getid /Node:myNode/]
        set serverEntries [$AdminConfig list ServerEntry $node]
        
        foreach serverEntry $serverEntries {
          set sName [$AdminConfig showAttribute $serverEntry serverName]
          if {$sName == $serverName} {
             set specialEndPoints [lindex [$AdminConfig showAttribute $serverEntry specialEndpoints] 0]
             foreach specialEndPoint $specialEndPoints {
                set endPointNm [$AdminConfig showAttribute $specialEndPoint endPointName]
                if {$endPointNm == "WC_defaulthost_secure"} {
                   set ePoint [$AdminConfig showAttribute $specialEndPoint endPoint]
                   $AdminConfig modify $ePoint [list [list host myhost] [list port 5544]]
                   break
                } 
             }
          }
        }
      • Using Jython:
        serverName = "server1"
        node = AdminConfig.getid('/Node:myNode/')
        serverEntries = AdminConfig.list('ServerEntry', node).split(java.lang.System.getProperty('line.separator'))
        
        for serverEntry in serverEntries:
          sName = AdminConfig.showAttribute(serverEntry, "serverName")
          if sName == serverName:
             sepString = AdminConfig.showAttribute(serverEntry, "specialEndpoints")
             sepList = sepString[1:len(sepString)-1].split(" ")
             for specialEndPoint in sepList:
                endPointNm = AdminConfig.showAttribute(specialEndPoint, "endPointName")
                if endPointNm == "WC_defaulthost_secure":
                   ePoint = AdminConfig.showAttribute(specialEndPoint, "endPoint")
                   AdminConfig.modify(ePoint, [["host", "myhost"], ["port", 5544]])
                   break
        
  • Modify the WC_adminhost attribute of the server1 process.

    To modify a WC_adminhost endpoint, use one of the following examples:

    • Using the AdminTask object:
      • Using Jacl:
        $AdminTask modifyServerPort server1 {-nodeName myNode -endPointName WC_adminhost -host myhost -port 6666}
      • Using Jython:
        AdminTask.modifyServerPort ('server1', '[-nodeName myNode -endPointName WC_adminhost -host myhost
         -port 6666]')
    • Using the AdminConfig object:
      • Using Jacl:
        set serverName server1
        set node [$AdminConfig getid /Node:myNode/]
        set serverEntries [$AdminConfig list ServerEntry $node]
        
        foreach serverEntry $serverEntries {
          set sName [$AdminConfig showAttribute $serverEntry serverName]
          if {$sName == $serverName} {
             set specialEndPoints [lindex [$AdminConfig showAttribute $serverEntry specialEndpoints] 0]
             foreach specialEndPoint $specialEndPoints {
                set endPointNm [$AdminConfig showAttribute $specialEndPoint endPointName]
                if {$endPointNm == "WC_adminhost"} {
                   set ePoint [$AdminConfig showAttribute $specialEndPoint endPoint]
                   $AdminConfig modify $ePoint [list [list host myhost] [list port 6666]]
                   break
                } 
             }
          }
        }
      • Using Jython:
        serverName = "server1"
        node = AdminConfig.getid('/Node:myNode/')
        serverEntries =
         AdminConfig.list('ServerEntry', node).split(java.lang.System.getProperty('line.separator'))
        
        for serverEntry in serverEntries:
          sName = AdminConfig.showAttribute(serverEntry, "serverName")
          if sName == serverName:
             sepString = AdminConfig.showAttribute(serverEntry, "specialEndpoints")
             sepList = sepString[1:len(sepString)-1].split(" ")
             for specialEndPoint in sepList:
                endPointNm = AdminConfig.showAttribute(specialEndPoint, "endPointName")
                if endPointNm == "WC_adminhost":
                   ePoint = AdminConfig.showAttribute(specialEndPoint, "endPoint")
                   AdminConfig.modify(ePoint, [["host", "myhost"], ["port", 6666]])
                   break
        
  • Modify the WC_adminhost_secure attribute of server1 process.

    To modify a WC_adminhost_secure endpoint, use one of the following examples:

    • Using the AdminTask object:
      • Using Jacl:
        $AdminTask modifyServerPort server1 {-nodeName myNode -endPointName WC_adminhost_secure -host
         myhost -port 5566}
      • Using Jython:
        AdminTask.modifyServerPort ('server1', '[-nodeName myNode -endPointName WC_adminhost_secure 
        -host myhost -port 5566]')
    • Using the AdminConfig object:
      • Using Jacl:
        set serverName server1
        set node [$AdminConfig getid /Node:myNode/]
        set serverEntries [$AdminConfig list ServerEntry $node]
        
        foreach serverEntry $serverEntries {
          set sName [$AdminConfig showAttribute $serverEntry serverName]
          if {$sName == $serverName} {
             set specialEndPoints [lindex [$AdminConfig showAttribute $serverEntry specialEndpoints] 0]
             foreach specialEndPoint $specialEndPoints {
                set endPointNm [$AdminConfig showAttribute $specialEndPoint endPointName]
                if {$endPointNm == "WC_adminhost_secure"} {
                   set ePoint [$AdminConfig showAttribute $specialEndPoint endPoint]
                   $AdminConfig modify $ePoint [list [list host myhost] [list port 5566]]
                   break
                } 
             }
          }
        }
      • Using Jython:
        serverName = "server1"
        node = AdminConfig.getid('/Node:myNode/')
        serverEntries = AdminConfig.list('ServerEntry', node).split(java.lang.System.getProperty('line.separator'))
        
        for serverEntry in serverEntries:
          sName = AdminConfig.showAttribute(serverEntry, "serverName")
          if sName == serverName:
             sepString = AdminConfig.showAttribute(serverEntry, "specialEndpoints")
             sepList = sepString[1:len(sepString)-1].split(" ")
             for specialEndPoint in sepList:
                endPointNm = AdminConfig.showAttribute(specialEndPoint, "endPointName")
                if endPointNm == "WC_adminhost_secure":
                   ePoint = AdminConfig.showAttribute(specialEndPoint, "endPoint")
                   AdminConfig.modify(ePoint, [["host", "myhost"], ["port", 5566]])
                   break
        

What to do next

Save the configuration changes.

Use the following command example to save your configuration changes:
AdminConfig.save()
Use the syncActiveNode or syncNode scripts in the AdminNodeManagement script library to propagate the configuration changes to node or nodes.
  • Use the syncActiveNodes script to propagate the changes to each node in the cell, as the following example demonstrates:
    AdminNodeManagement.syncActiveNodes()
  • Use the syncNode script to propagate the changes to a specific node, as the following example demonstrates:
    AdminNodeManagement.syncNode("myNode")