Spring boot 启动报错: Protocol handler start failed | Cannot assign requested address: bind
Posted Dream_it_possible!
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Spring boot 启动报错: Protocol handler start failed | Cannot assign requested address: bind相关的知识,希望对你有一定的参考价值。
Springboot项目突然起不来,一直报错:
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:229) ~[spring-boot-2.3.8.RELEASE.jar:2.3.8.RELEASE]
at org.springframework.boot.web.servlet.context.WebServerStartStopLifecycle.start(WebServerStartStopLifecycle.java:43) ~[spring-boot-2.3.8.RELEASE.jar:2.3.8.RELEASE]
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
... 19 common frames omitted
Caused by: java.lang.IllegalArgumentException: standardService.connector.startFailed
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:244) ~[tomcat-embed-core-9.0.41.jar:9.0.41]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors(TomcatWebServer.java:282) ~[spring-boot-2.3.8.RELEASE.jar:2.3.8.RELEASE]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:213) ~[spring-boot-2.3.8.RELEASE.jar:2.3.8.RELEASE]
... 21 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Protocol handler start failed
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1067) ~[tomcat-embed-core-9.0.41.jar:9.0.41]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.41.jar:9.0.41]
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:240) ~[tomcat-embed-core-9.0.41.jar:9.0.41]
... 23 common frames omitted
Caused by: java.net.BindException: Cannot assign requested address: bind
检查端口是否被占用,使用cmd查看
然而并没有应用在使用8080端口运行。
然后以为是mysql的驱动问题,将mysql的驱动依赖更改为 5.1.46,适合mysql:5.7 的server。
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.46</version>
</dependency>
重新启动依然报错:
不是mysql驱动的问题, 检查参数,发现了真正的问题是因为我加了一个server.address参数,本来想把该参数作为mysql的host主机,不料此参数却成了tomcat的启动参数之一: server.address , 导致了tomcat一直启动不起来。
tomcat重写了server.address后就会使用目标的Ip作为server来启动,显然用192.168.31.129是启动不起来的。
解决方法: 将参数换为 server.host, 修改完毕后,重写启动成功!
踩坑指南: 在使用参数、给参数起名时,一定要注意和避免因与server自带的参数重名而导致的其他问题!
以上是关于Spring boot 启动报错: Protocol handler start failed | Cannot assign requested address: bind的主要内容,如果未能解决你的问题,请参考以下文章