6月19日,需要修改一个BUG,打开IDEA debug起来 ,一直报错。
查看日志:View-Tool Windows-EventLog
16:43 Error running 'tomcat9': Address localhost:1099 is already in use
16:43 Error running 'tomcat9': Unable to open debugger port (127.0.0.1:5521): java.net.SocketException "Socket closed"
尝试了各种修改JVM端口,重启IDE,依然无效.
最后查看tomat日志:
19-Jun-2019 16:41:59.098 严重 [main] org.apache.catalina.core.StandardServer.await Failed to create server shutdown socket on address [localhost] and port [8005] (base port [8005] and offset [0])
java.net.BindException: Can't assign requested address (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.
at org.apache.catalina.core.StandardServer.await(StandardServer.java:582)
at org.apache.catalina.startup.Catalina.await(Catalina.java:726)
at org.apache.catalina.startup.Catalina.start(Catalina.java:672)
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:350)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)
Can't assign requested address (Bind failed)!!!!!
最后解决的方法是,在本机添加一个host:
127.0.0.1 localhost