Changing the default port in Apache Tomcat
Locate the server.xml file in your %CATALINE_HOME%
Most of the time we don't write code. We configure environments and all kind of tools as a prerequisite. Checking the port used by the Oracle installation or by the Tomcat server in order to setup your Java EE environment is an easy task that can be achieved in a few ways.
Go to your Tomcat directory\conf and open server.xml
<!-- ==================== Connectors ==================== -->
<!-- Normal HTTP -->
Change the port parameter and save. Note that if you have already imported a server configuration in Eclipse, for example, you will need to refresh it or even change it directly from the properties.
Checking the ports
Checking if a port is open using Telnet
Before doing that, you should check which ports are in use and if there is a conflict at all. The easiest way to check if a port is open is to open the command prompt and use Telnet :
Checking the ports which are in use and the related processes with netstat
Unfortunately, Telnet is not installed by default on Windows 7. You can either activate it from Control Panel > Programs and Features > Turn Windows features on or off, or use netstat instead.
netstat -a will list all the currently opened ports with the related remote connections. You can also use the -b option to list the connections along with the processes that have opened them - netstat -ab. Note that you need to start the command prompt as administrator (right-click -> Run as Administrator in Windows 7) or you'll receive a warning message:
The requested operation requires elevation.
Using CPorts to check the ports and the related processes
Another possibility is to use a specific program for that, which provides a nice UI and few additional features, like for example CPorts.
Nice program, very lightweight, no advertisements attached. In my case, tnslsnr.exe (Oracle) was already using the port and that's why the J2EE container was not able to start.
About the author: