Update ports in existing profiles
Use the updatePorts.ant script to change ports in an installed profile. Each profile template has its own updatePorts.ant script. The updatePorts.ant script for application server profiles is in the directory...
app_server_root/profileTemplates/template_name/actions
To use the script, identify which profile to update.
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 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 .gotcha
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.
- 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 we 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
- Open a command shell window.
- Run...
cd /opt/IBM/WebSphere/AppServer/bin
./ws_ant.sh -propertyfile /tmp/was_props/appserver.props -file WAS_HOME/profileTemplates/default/actions/updatePorts.ant< /ul>
- Open the console and view the changed port assignments.
To view the port assignments, click Servers > Application servers > server_name > [Communications] Ports.
- 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.
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.
- 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 we create the following...
C:\temp\was_props\appserver.props properties
WAS_HOME="C:/IBM/WebSphere/AppServer"
was.install.root="C:/IBM/WebSphere/AppServer"
profileName=AppSrv02
profilePath="C:/IBM/WebSphere/AppServer/profiles/AppSrv02"
templatePath="C:/IBM/WebSphere/AppServer/profileTemplates/default"
nodeName=appserver_node02
cellName=appserver_cell02
hostName=myserver2.ibm.com defaultPorts=trueUse 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.
- Open a DOS command window and run...
cd C:\IBM\WebSphere\AppServer\bin directory.
ws_ant.bat -propertyfile C:\temp\was_props\appserver.props -file "C:\IBM\WAS\AppServer\profileTemplates\default\actions\updatePorts.ant"
- Open the console and view the changed port assignments.
To view the port assignments, click Servers > Application servers > server_name > [Communications] Ports.
- 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 file...
C:\IBM\WebSphere\AppServer\profiles\AppSrv02\config\cells\appserver_cell02\nodes\appserver_node02\serverindex.xml
Issue the netstat -a command to see all ports in use on the machine.
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.
- 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 we 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
- From command shell window...
cd /usr/IBM/WebSphere/AppServer/bin
./ws_ant.sh -propertyfile /usr/tmp/was_props/appserver.props -file /usr/IBM/WebSphere/AppServer/profileTemplates/default/actions/updatePorts.ant
- Open the console and view the changed port assignments.
To view the port assignments, click Servers > Application servers > server_name > [Communications] Ports.
- 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.
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.
- Create the Java properties file encoded in ISO8859-1 file encoding, to assign nonconflicting port values to the application server profile.
Assume that we 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=45061The 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 we 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
- Open a command shell window.
cd /opt/IBM/WebSphere/AppServer/bin
ws_ant.sh -propertyfile /tmp/was_props/appserver.props -file /opt/IBM/WebSphere/AppServer/profileTemplates/default/actions/updatePorts.ant
- Open the console and view the changed port assignments.
To view the port assignments, click Servers > Application servers > server_name > [Communications] Ports.
- 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.
(dist)
Results
This procedure results in four different methods of port assignments with the updatePorts.ant script.