Several ports (8005, 8080, 8009) required by Tomcat v8.0 Server at localhost are already in use

说明

今天在运行一个Java web 程序的时候出现了很多问题,因为用了struts框架。后面还遇到了端口被占用的问题,现在就记录一下怎么解决端口被占用的问题。

详细信息

Several ports (8005, 8080, 8009) required by Tomcat v8.0 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 change the port number(s).
Several ports (8005, 8080, 8009) required by Tomcat v8.0 Server at localhost are already in use_第1张图片
一般端口被占用会出现这样的提示。

查看自己tomcat的端口号

在一台计算机上,可以启动多个端口号不一样的tomcat, 所以请确保自己访问的是正确的那个端口号,好像默认是80。可以在tomcat安装目录下的conf文件夹下的server.xml中查看
Several ports (8005, 8080, 8009) required by Tomcat v8.0 Server at localhost are already in use_第2张图片
用记事本打开,找到port对应的值,要认真找,里面很多注释
Several ports (8005, 8080, 8009) required by Tomcat v8.0 Server at localhost are already in use_第3张图片
我这里是8080,所以如果我的8080端口号被占用了,那么会出问题。
下面来解决这个问题

解决方法

用win+R打开cmd,输入netstat -ano
找到本地地址是0.0.0.0:8080所对应的PID,我这里是10736
Several ports (8005, 8080, 8009) required by Tomcat v8.0 Server at localhost are already in use_第4张图片
所以我们知道这个时候占用我们端口号的是一个PID为10736的进程,打开任务管理器,结束PID为10736的进程就可以了。
Several ports (8005, 8080, 8009) required by Tomcat v8.0 Server at localhost are already in use_第5张图片
选中PID为10736的进程,结束任务。
最好重新启动tomcat,然后该问题就解决了。

你可能感兴趣的:(问题解决,tomcat,port)