Issue with apache tomcat server always running a program its showing that port 8080 is already used..
netstat -ano | findstr < Port Number >
taskkill /F /PID < Process Id >
I tried this every time that error is shown the problem is solved.
but has to done each time the server to be started or restarted.
I want a permanent solution to resolve this instead of each and every time manually stop the process in 8080..
3
Answers
you could either change the port of the other process to avoid a port conflict, or simply change it in tomcat
How to change tomcat port number
and change it to something like 8081
Looks like a service automatically starts on each startup, have you had a look between your services which automatically restarts?
You can have a look which executable is running on which port with following command (needs admin privileges):
Got the command from here:
How can you find out which process is listening on a port on Windows?
and you should have an output like this:
This should give already a hint which process automatically start on each startup, you can have a look in the service tab (you open a run window and input services.msc and press enter)
Since you are using netstat, I believe you are using Windows. There are two ways in which you can handle the issue:
Disable tomcat service that is running by checking in services.msc. You can change the mode of startup from automatic to manual. This usually happens when you have installed a software using an msi that installs the tomcat service as a part of it.
You can try to change your tomcat server port by editing the following lines in the /conf/server.xml:
Change
port = 8080
to something else likeport = 8082
. In that way, you can continue using the customized tomcat without harming any other essential service that has been installed as mentioned in point #1 above