java.net.BindException: Cannot assign requested address: bind

异常信息

时间:2017-03-16 10:21:05,644 - 级别:[ERROR] - 消息: [other] Failed to start end point associated with ProtocolHandler ["http-nio-192.168.200.116-10001"] - 位置:org.apache.coyote.http11.Http11NioProtocol:182
java.net.BindException: Cannot assign requested address: bind
    at sun.nio.ch.Net.bind0(Native Method)
    at sun.nio.ch.Net.bind(Unknown Source)
    at sun.nio.ch.Net.bind(Unknown Source)
    at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
    at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
    at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:340)
    at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:773)
    at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:473)
    at org.apache.catalina.connector.Connector.startInternal(Connector.java:986)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
    at org.apache.catalina.core.StandardService.addConnector(StandardService.java:239)
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.addPreviouslyRemovedConnectors(TomcatEmbeddedServletContainer.java:194)
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:151)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:293)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
    at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180)
    at hls.itms.web.collect.CollectApplication.main(CollectApplication.java:24)
时间:2017-03-16 10:21:05,645 - 级别:[ERROR] - 消息: [other] Failed to start connector [Connector[HTTP/1.1-10001]] - 位置:org.apache.catalina.core.StandardService:182
org.apache.catalina.LifecycleException: Failed to start component [Connector[HTTP/1.1-10001]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
    at org.apache.catalina.core.StandardService.addConnector(StandardService.java:239)
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.addPreviouslyRemovedConnectors(TomcatEmbeddedServletContainer.java:194)
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:151)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:293)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
    at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180)
    at hls.itms.web.collect.CollectApplication.main(CollectApplication.java:24)
Caused by: org.apache.catalina.LifecycleException: service.getName(): "Tomcat";  Protocol handler start failed
    at org.apache.catalina.connector.Connector.startInternal(Connector.java:993)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
    ... 13 common frames omitted

两种情况:

1.端口号被占用,导致地址无法绑定

windows查看端口pid
netstat -aon|findstr 8080(端口号)

linux查看端口占用
netstat -anp|grep 8080

2.ip地址与本机地址不匹配,导致地址无法绑定

windows查看ip
ipconfig

linux查看ip
ifconfig

 

posted on 2017-03-16 10:36  流年染指了悲伤  阅读(21607)  评论(0编辑  收藏  举报