Updating ports in existing profiles

Use the updatePorts.ant script to change ports in an installed profile.

Before you begin

Each profile template has its own updatePorts.ant script.

The updatePorts.ant script for application server profiles is in the app_server_root/profileTemplates/template_name/actions directory. To use the script, you have to identify which profile to update.

Note: You should only run this script if the profile is unfederated and if the configuration is the same structure as it was when the profile was created. For example, this script is ideal for changing ports for an unfederated application server profile after you created the profile but before you altered its configuration. For all other situations, use the techniques described in Setting port numbers kept in the serverindex.xml file using scripting.

About this task

Use the following procedure to become familiar with using the updatePorts.ant script. Each step is an exercise that results in reassigning ports using a particular method that the updatePorts.ant script supports.

Look at steps for all of the operating systems mentioned. The differences are mainly in the extension of the script file and the direction of the directory delimiters. For example, Linux® shell scripts (*.sh) and other commands require a ./ before the command to tell the operating system that the command is in the current working directory.

[AIX Solaris HP-UX Linux Windows]

Procedure

  • [Linux]Assign nonconflicting ports to the AppSrv01 profile.

    The ANT script assigns nonconflicting ports by default. No special arguments are needed. Identify the fully qualified directory paths, profile name, unique node name, and unique cell name. Then issue the command.

    1. Create the Java™ properties file encoded in ISO8859-1 file encoding, to assign nonconflicting port values to the application server profile.

      For this example, assume that the system is a Linux operating system and that you create the following /TMP/was_props/appserver.props properties file.

      WAS_HOME=/opt/IBM/WebSphere/AppServer 
      was.install.root=/opt/IBM/WebSphere/AppServer
      profileName=AppSrv01
      profilePath=/opt/IBM/WebSphere/AppServer/profiles/AppSrv01
      templatePath=/opt/IBM/WebSphere/AppServer/profileTemplates/default
      nodeName=appserver_node01
      cellName=appserver_cell01
      hostName=myserver.ibm.com
      
    2. Open a command shell window.
    3. Change directories to the /opt/IBM/WebSphere/AppServer/bin directory.
      cd /opt/IBM/WebSphere/AppServer/bin
      (Or, if the product is installed to a non-default directory, change directories to the app_server_root/bin directory.)
    4. Issue the command.
      ./ws_ant.sh -propertyfile /TMP/was_props/appserver.props \
                  -file /opt/IBM/WebSphere/AppServer/profileTemplates/default/actions/updatePorts.ant
      
    5. Open the administrative console and view the changed port assignments.

      To view the port assignments, click Servers > Application servers > server_name > [Communications] Ports.

    6. Run the script again and view the ports. Are they the same as before?

    The resulting dynamically assigned port values apply to all of the ports currently assigned to the AppSrv01 profile, for every server listed in the serverindex.xml file for the profile node name. Each port receives a new nonconflicting value. None of the old port value assignments are used because the port values are in use at the time of the new assignment.

  • [Windows]Assign default ports to the AppSrv02 profile.

    The ANT script assigns nonconflicting ports by default. The defaultPorts=true special argument is needed. Identify the fully qualified directory paths, profile name, unique node name, and unique cell name. Then issue the command.

    1. Create the Java properties file encoded in ISO8859-1 file encoding, to assign default port values to the application server profile.

      For this example, assume that the system is a Windows operating system and that you create the following C:\temp\was_props\appserver.props properties file.

      WAS_HOME="C:/Program Files/IBM/WebSphere/AppServer" 
      was.install.root="C:/Program Files/IBM/WebSphere/AppServer"
      profileName=AppSrv02
      profilePath="C:/Program Files/IBM/WebSphere/AppServer/profiles/AppSrv02"
      templatePath="C:/Program Files/IBM/WebSphere/AppServer/profileTemplates/default"
      nodeName=appserver_node02
      cellName=appserver_cell02
      hostName=myserver2.ibm.com
      defaultPorts=true
      

      Use double quotation marks around a Windows path name with spaces. Do not use quotation marks around the path name if there are no spaces in the path.

    2. Open a DOS command window.
    3. Change directories to the C:\Program Files\IBM\WebSphere\AppServer\bin directory.
      cd "C:\Program Files\IBM\WebSphere\AppServer\bin"
      (Or, if the product is installed to a non-default directory, change directories to the app_server_root/bin directory.)
    4. Issue the command.
      ws_ant.bat -propertyfile C:\temp\was_props\appserver.props
       -file "C:\Program Files\IBM\WebSphere\AppServer\profileTemplates\default\actions\updatePorts.ant"
      
    5. Open the administrative console and view the changed port assignments.

      To view the port assignments, click Servers > Application servers > server_name > [Communications] Ports.

    6. Run the script again and view the ports. Are they the same as before?

    The resulting assigned port values are the same each time because the values are the default values. This method does not resolve conflicting port assignments. To view all port assignments for a profile, see the C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv02\config\cells\appserver_cell02\nodes\appserver_node02\serverindex.xml file. Issue the netstat -a command to see all ports in use on the machine.

  • [AIX]Assign ports starting at 2050 to the AppSrv03 profile.

    The ANT script assigns nonconflicting ports by default. The startingPort=2050 special argument is needed. Identify the fully qualified directory paths, profile name, unique node name, and unique cell name. Then issue the command.

    1. Create the Java properties file encoded in ISO8859-1 file encoding, to assign default port values to the application server profile.

      For this example, assume that the system is an AIX® operating system and that you create the following /usr/tmp/was_props/appserver.props properties file.

      WAS_HOME=/usr/IBM/WebSphere/AppServer 
      was.install.root=/usr/IBM/WebSphere/AppServer
      profileName=AppSrv03
      profilePath=/usr/IBM/WebSphere/AppServer/profiles/AppSrv03"
      templatePath=/usr/IBM/WebSphere/AppServer/profileTemplates/default"
      nodeName=appserver_node03
      cellName=appserver_cell03
      hostName=myserver3.ibm.com
      startingPort=2050
      
    2. Open a command shell window.
    3. Change directories to the /usr/IBM/WebSphere/AppServer/bin directory.
      cd /usr/IBM/WebSphere/AppServer/bin
      (Or, if the product is installed to a non-default directory, change directories to the app_server_root/bin directory.)
    4. Issue the command.
      ./ws_ant.sh -propertyfile /usr/tmp/was_props/appserver.props \
                  -file /usr/IBM/WebSphere/AppServer/profileTemplates/default/actions/updatePorts.ant
      
    5. Open the administrative console and view the changed port assignments.

      To view the port assignments, click Servers > Application servers > server_name > [Communications] Ports.

    6. Run the script again and view the ports. Are they the same as before?

    After using the -startingPort option, the resulting dynamically assigned port values are not the same each time because the ANT script assigns nonconflicting port values starting from the startingPort number (port 2050 in this case). This method resolves conflicting port assignments.

  • [HP-UX][Solaris]Use a port definition property file to assign ports to the AppSrv04 profile.

    The ANT script assigns nonconflicting ports by default. The portsFile=/opt/was/portdefs.our_appsrv_ex.props special argument is needed. Identify the fully qualified directory paths, profile name, unique node name, and unique cell name. Then issue the command.

    1. Create the Java properties file encoded in ISO8859-1 file encoding, to assign nonconflicting port values to the application server profile.
      Assume that you create the following /opt/was/portdefs.our_appsrv_ex.props properties file:
      WC_defaulthost=19080
      WC_adminhost=19060
      WC_defaulthost_secure=19443
      WC_adminhost_secure=19043
      BOOTSTRAP_ADDRESS=22809
      SOAP_CONNECTOR_ADDRESS=28880
      IPC_CONNECTOR_ADDRESS=9633
      SAS_SSL_SERVERAUTH_LISTENER_ADDRESS=29401
      CSIV2_SSL_SERVERAUTH_LISTENER_ADDRESS=29403
      CSIV2_SSL_MUTUALAUTH_LISTENER_ADDRESS=29402
      ORB_LISTENER_ADDRESS=39100
      DCS_UNICAST_ADDRESS=39353
      SIB_ENDPOINT_ADDRESS=37276
      SIB_ENDPOINT_SECURE_ADDRESS=37286
      SIB_MQ_ENDPOINT_ADDRESS=45558
      SIB_MQ_ENDPOINT_SECURE_ADDRESS=45578
      SIP_DEFAULTHOST=45060
      SIP_DEFAULTHOST_SECURE=45061
      Note: The ports used in the port definition property file should reflect the template type. The ports in this example are for the default template type, and they might vary for other template types. The management template has three different portdef.props files, one for each servertype. They are adminagent.portdef.props, dmgr.portdef.props and jmgr.portdef.props. They can be modelled after the portdef.props file found in the template directory.

      Assume that you create the following /TMP/was_props/appserver.props properties file:

      WAS_HOME=/opt/IBM/WebSphere/AppServer 
      was.install.root=/opt/IBM/WebSphere/AppServer
      profileName=AppSrv04
      profilePath=/opt/IBM/WebSphere/AppServer/profiles/AppSrv04
      templatePath=/opt/IBM/WebSphere/AppServer/profileTemplates/default
      nodeName=appserver_node04
      cellName=appserver_cell04
      hostName=myserver4.ibm.com
      portsFile=/opt/was/portdefs.our_appsrv_ex.props
      
    2. Open a command shell window.
    3. Change directories to the /opt/IBM/WebSphere/AppServer/bin directory.
      cd /opt/IBM/WebSphere/AppServer/bin
      (Or, if the product is installed to a non-default directory, change directories to the app_server_root/bin directory.)
    4. Issue the command.
      ./ws_ant.sh -propertyfile /TMP/was_props/appserver.props \
                  -file /opt/IBM/WebSphere/AppServer/profileTemplates/default/actions/updatePorts.ant
      
    5. Open the administrative console and view the changed port assignments.

      To view the port assignments, click Servers > Application servers > server_name > [Communications] Ports.

    6. Run the script again and view the ports. Are they the same as before?

    The resulting assigned port values are from a props file. Therefore, the values do not change. This method does not resolve conflicting port assignments.

[AIX Solaris HP-UX Linux Windows]

Results

This procedure results in four different methods of port assignments with the updatePorts.ant script.