0

When I attempt to run TomCat v.7.0 through Eclipse, occasionally I'll get a message saying that the port is already being used. I've double-checked my services, and cannot find anything else running Tomcat, nor on that port. Task Manager also doesn't show any suspicious processes or applications.

If I restart my machine, open Eclipse, and immediately start the Tomcat server, then the port seems to be open. If I stop it, and then try to re-start it again, sometimes I get the "port is being used" error, and sometimes I don't.

Anyone know some tricks to figure out what's using that port? Is Eclipse stopping the server incorrectly? Thank you!

EDIT: Ports being used by Tomcat are 80 and 443. I looked at the PID in Task Manager, and tried netstat -nao and didn't see either of those numbers mentioned.

Michelle
  • 365
  • 1
  • 4
  • 18
  • To find out what is using the port, ask the question on superuser (but search first!): here are a couple that might help http://superuser.com/a/348662 or http://superuser.com/a/627394 – Jonah Graham Jan 08 '16 at 19:09
  • See this : http://stackoverflow.com/questions/4341082/how-to-kill-tomcat-when-running-it-from-eclipse – SomeDude Jan 08 '16 at 19:10

2 Answers2

1

This is because of a misbehaving Tomcat/Java process mostly when used from within Eclipse,that could be holding up the Port.Guessing you are on windows Platform since you mentioned task manager you can use the resource monitor to identify the process and kill it. Open Run dialog and type resmon.exe.Look under

Network->Listening Port to identify the culprit.

Also try navigating to localhost:8080 and see if you can see the tomcat default page, this way you can confirm if its Tomcat that is using the port.

M4ver1k
  • 1,505
  • 1
  • 15
  • 26
0

It's probably due to bad shutdown / crash of Tomcat, which never releases the system port. I've definitely experienced just this sort of thing before. As a workaround, check for and make sure you kill all processes related to tomcat and java, even after the server is shut down / has crashed

ControlAltDel
  • 33,923
  • 10
  • 53
  • 80
  • I'm not seeing any obvious processes relating to tomcat.exe or java.exe. Are there any others you've seen that I'm just not thinking of? I also tried this from the command window: wmic process where "commandline like '%tomcat%' and name='java.exe'", and found no instances available. – Michelle Jan 08 '16 at 19:29