0

I am attempting basic hello restAPi following this link. The program is done in java in eclipse.

However towards I get the error:

Several ports (8005, 8080, 8009) required by Tomcat v8.5 Server at localhost are already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or or change the port number(s).

I have tried changing port number, it doesn't work.

I have did the checks and I get the apache home page on 8080 and not on the changed port number 8081. Running on 8081 gives me a 404 response while running on 8080 throws the error shown above.

What's the way around this behavior?

Any help is appreciated.

Eswar
  • 1,001
  • 17
  • 33
  • So it sounds like you have TomCat running already, for a start. When you run the application in Eclipse, have you got it configured to start an embedded Tomcat as well ? This will give the error. I think you can configure the embedded one on a different port, but can't remember how to do it in Eclipse. You could prove this, by stopping the external Tomcat while you test. – jr593 Aug 22 '18 at 10:16
  • @jr593 following this link:https://www.youtube.com/watch?v=qnmYA839_1M I have attempted to change the port number but I still get 404 response. – Eswar Aug 22 '18 at 10:18

1 Answers1

1

Get the PID of the process which is using ports (8005, 8080, 8009) and end the process from Task Manager if required.

To get PID, follow this answer

Just open a command shell and type : (saying your port is 123456)

netstat -a -n -o | find "123456"

You will see everything you need

The headers are :

Proto  Local Address          Foreign Address        State          PID  
TCP    0.0.0.0:37             0.0.0.0:0              LISTENING      1111
priyam
  • 62
  • 7
  • Using the above, I get two processes that are running/listening. Which one to kill? – Eswar Aug 22 '18 at 10:47
  • both the pid's were the same, I killed the process and restarted the program on the server. But in eclipse the response gives 404 still... – Eswar Aug 22 '18 at 10:54
  • After killing the pid's are you still facing the tomcat issue? – Nicholas K Aug 22 '18 at 11:25
  • @NicholasK uninstalling and re-installing seems to have solved the problem. But this time I get the 404 response with an list of errors where all of them are of filenotfound. Looks like some jars have not been found. Any clue what can be done now? – Eswar Aug 23 '18 at 06:31
  • FilenotFound? Please elaborate on what error you are getting exactly – Nicholas K Aug 23 '18 at 08:09