这是因为tomcat未正确关闭导致的端口占用问题

找到报错中被占用的端口kill掉进程即可,一般是8080,也有下面这种8005的

11-Mar-2019 14:46:12.405 SEVERE [main] org.apache.catalina.core.StandardServer.await StandardServer.await: create[localhost:8005]: 
java.net.BindException: Address already in use (Bind failed)
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
at java.net.ServerSocket.bind(ServerSocket.java:375)
at java.net.ServerSocket.<init>(ServerSocket.java:237)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:440)
at org.apache.catalina.startup.Catalina.await(Catalina.java:775)
at org.apache.catalina.startup.Catalina.start(Catalina.java:721)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:353)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:493)

 

像下面这样筛选出来,然后kill掉进程号就行,比如 kill 10701

[root@localhost ~]# netstat -nltp | grep 8005
tcp6 0 0 127.0.0.1:8005 :::* LISTEN 10701/java
[root@localhost ~]# netstat -nltp | grep 8080
tcp6 0 0 :::8080 :::* LISTEN 10701/java