tomcat SEVERE: StandardServer.await: create[8005] : java.net.BindException: Cann

今天在启动tomcat时发现

Apr 16, 2010 8:58:26 AM org.apache.coyote.http11.Http11AprProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Apr 16, 2010 8:58:26 AM org.apache.coyote.ajp.AjpAprProtocol start
INFO: Starting Coyote AJP/1.3 on ajp-8009
Apr 16, 2010 8:58:26 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 4218 ms
Apr 16, 2010 8:58:26 AM org.apache.catalina.core.StandardServer await
SEVERE: StandardServer.await: create[8005]:
java.net.BindException: Cannot assign requested address
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:365)
        at java.net.ServerSocket.bind(ServerSocket.java:319)
        at java.net.ServerSocket.<init>(ServerSocket.java:185)
        at org.apache.catalina.core.StandardServer.await(StandardServer.java:373)
        at org.apache.catalina.startup.Catalina.await(Catalina.java:647)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:607)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

 

从日志上看, tomcat是启动了, 但是不能绑定8005端口. 出现Cannot assign requested address的原因是

localhost被路由到了别的机器.

 

Java代码
  1. ping localhost  
ping localhost
 

发现确实被理由到了别的机器.

 

修改localhost让它重新指向本机 127.0.0.1

 

Java代码
  1. vi /etc/hosts  
vi /etc/hosts
 

删除掉里面关于localhost的转向, 然后增加一行

Java代码
  1. 127.0.0.1 localhost  
127.0.0.1 localhost

 

重新启动tomcat, 一切问题都解决.

你可能感兴趣的:(tomcat,职场,休闲,8005)