404 response while running simple hello restapi on tomcat

202 Views Asked by At

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.

1

There are 1 best solutions below

5
priyam On BEST ANSWER

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