As a WebSphere administrator, one of the tasks you should be aware of changing the port number for the JVM.
Changing the port in other Middleware product like Apache, Nginx is easy but when it comes to WebSphere – you have to take few additional steps.
There are multiple ways to achieve this and following you will learn probably the easiest way.
Below demonstration is done in WebSphere 9 and should be ok another version too.
Let’s look at the current port details.
Currently, I’ve one JVM called “server1” and port number is 9080 and target are to change to 9090.
This requires changes at two places; let’s get it started.
- Login into WebSphere Administrative Console
- Go to Servers >> Server Types >> WebSphere application servers
- Click on JVM “server1”
- Click “Ports” under Communications
- Scroll down and click on “WC_defaulthost”
- Update the port from 9080 to 9090 here and click Ok
- Review and save the configuration
Now, you need to update the virtual host. At right navigation;
- Go to Environment >> Virtual hosts >> default_host >> Host Aliases
- Click on entry where it says “9080”
- Update the port 9090 and click OK
- Review and save the configuration.
Let’s verify to ensure there is no configuration file contains an old port number. You will use grep command (assuming on Linux environment).
- Login to WAS server
- Go to profile path
- Search for “9080” port; you can use the below command
grep -R 9080 * | grep -v -e logs -e templates
Above, I am excluding to ignore “logs” and “templates” as they are not concerned. Command shouldn’t result in any configuration file especially XML file.
Restart the JVM and use netstat to ensure new port 9090 listening
[root@localhost profiles]# netstat -anlp |grep 9090 tcp6 0 0 :::9090 :::* LISTEN 17239/java [root@localhost profiles]#
So you can see “server1” JVM port is changed now. I hope the above instructions help you.