Update ports in existing profiles on distributed
To change ports in an installed profile, run:
app_server_root/profileTemplates/template_name/actions/updatePorts.ant
To use the script, we have to 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 we created the profile but before you altered its configuration.
Tasks
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 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.
- 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.)
- Issue the command.
./ws_ant.sh -propertyfile /TMP/was_props/appserver.props -file /opt/IBM/WebSphere/AppServer/profileTemplates/default/actions/updatePorts.ant
- Open the administrative console and view the changed port assignments.
To view the port assignments, click...
Servers > Application servers > server > [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.