运行 tomcat 上的简单问候 restapi 时 404 响应

404 response while running simple hello restapi on tomcat

我正在尝试遵循此 link 的基本 hello restAPI。程序在eclipse中java完成

但是我得到了错误:

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).

我试过更改端口号,但没有用。

我已经进行了检查,我在 8080 上获得了 apache 主页,而不是在更改后的端口号 8081 上。运行 在 8081 上给我一个 404 响应,而在 8080 上 运行 抛出上面显示的错误。

解决此行为的方法是什么?

感谢任何帮助。

获取正在使用端口(8005、8080、8009)的进程的 PID,并在需要时从任务管理器中结束进程。

要获取 PID,请遵循此 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