Thursday, 31 August 2017

Tomcat - Change tomcat accessing port

           Change tomcat accessing port


  • Goto tomcat>conf folder
  • Edit server.xml
  • Search "Connector port"
  • Replace "8080" by your port number
  • Restart tomcat server.
You are done!.


=====================================

Navigate to /tomcat-root/conf folder. Within you will find the server.xml file.
Open the server.xml in your preferred editor. Search the below similar statement (not exactly same as below will differ)
    <Connector port="8080" protocol="HTTP/1.1" 
           connectionTimeout="20000" 
           redirectPort="8443" />
Going to give the port number to 9090
     <Connector port="9090" protocol="HTTP/1.1" 
           connectionTimeout="20000" 
           redirectPort="8443" />
Save the file and restart the server. Now the tomcat will listen at port 9090


===================================================================

Several ports (8005, 8080, 8009) required by Tomcat Server at localhost are already in use



If you are running on windows try this in the command line prompt:
netstat -ano
This will show all ports in use and the process id PID # of the process that is using that port. Then Ctrl+Alt+Del and open Task Manager to see which process is that.
You can then choose either to close/stop it or configure your server to use another port. To check if the new choosen port (let's say 8010) is available do this:
netstat -ano | grep 8010
If it does not return any lines then you are fine.
To change the port go to the Server view, open server.xml and change the port there. Mine has this entry:
Connector port="8010" protocol="AJP/1.3" redirectPort="8443"

========================================================================

Port 80 is being used by SYSTEM (PID 4), what is that?


check for services running on 

netstat -o -n -a |findstr 0.0.:8080

--------------------------------
Also, try stopping "SQL Server Reporting Services (MSSQLSERVER)", that apparently defaults to 80. I did that and port 80 freed up. PID identified the culprit as "System", but apparently that System can mean multiple things.
--------------------------------------------------------

There are many services, which can listen port 80 on windows.
Luckily you can detect and stop them all running simple console command:
NET stop HTTP

Disable Unnecessary System Services Locally

  1. Open the Computer Management interface.
  2. In the console tree, expand Services and Applications and select Services.
  3. From the right-hand pane, select a service to disable. Right-click on the selected service and select Properties.
  4. The Properties dialog box for the selected services will appear. From the Startup type: drop down menu, select Disabled.
    Dd277425.w2kab190(en-us,TechNet.10).gif
  5. Under Service status: click on the Stop button.
  6. Click the OK button.

===================================================


  1. Select “Default Web Site” from the left tree in IIS manager.
  2. Click Bindings from the right sidebar to open a dialog box.
  3. Select “http” record from the grid and hit Edit.
  4. Enter your choice of port number in “Port” Text box and hit OK.





==============================

No comments:

Post a Comment