Tomcat启动异常 java.net.BindException: Cannot assign requested address: JVM_Bind

从Apache官网下载的tomcat7,在MyEclipse中启动时抛出如下异常:

  

严重: StandardServer.await: create[localhost:8005]:
  java.net.BindException: Cannot assign requested address: JVM_Bind
  at java.net.PlainSocketImpl.socketBind(Native Method)
  at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
  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:444)
  at org.apache.catalina.startup.Catalina.await(Catalina.java:781)
  at org.apache.catalina.startup.Catalina.start(Catalina.java:727)
  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:294)
  at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:428)

搜索原因和解决方法:

  确定8080端口未被占用。DOS命令netstat -an

  在C:\Windows\System32\drivers\etc\hosts中有如下内容:

    127.0.0.1       localhost

    192.168.1.106    localhost

  其中192.168.1.106是不存在本地的ip,删除此ip项后,再启动OK了!

  在服务器领域,一台计算机配置多个IP地址是常见的。tomcat在启动时,

会根据配置去获取所有的IP地址,并逐个绑定,当发现需要绑定的IP地址不存在时,

会触发上述异常,导致无法正常启动。

上一篇:服务器启动socket服务报错 java.net.BindException:Cannot assign requested address


下一篇:Vue.js搭建路由报错 router.map is not a function,Cannot read property ‘component’ of undefined