[解决问题] The Tomcat connector configured to listen on port 8080 failed to start.

Dear 丶 2023-06-28 04:51 61阅读 0赞

前言:
今天在启动springboot项目的时候,遇到了这个问题,心里很是奇怪,明明没有项目启动,怎么还占用了8080端口。所以为了排查问题,使用命令行查看端口,并解决了问题。

错误提示

  1. org.apache.catalina.LifecycleException: Failed to start component [Connector[HTTP/1.1-8080]]
  2. at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
  3. at org.apache.catalina.core.StandardService.addConnector(StandardService.java:225) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
  4. at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors(TomcatWebServer.java:256) [spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
  5. at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:198) [spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
  6. at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.startWebServer(ServletWebServerApplicationContext.java:300) [spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
  7. at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:162) [spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
  8. at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553) [spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE]
  9. at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) [spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
  10. at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
  11. at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) [spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
  12. at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
  13. at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) [spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
  14. at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) [spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
  15. at com.ray.lesson5.Lesson5Application.main(Lesson5Application.java:10) [classes/:na]
  16. Caused by: org.apache.catalina.LifecycleException: Protocol handler start failed
  17. at org.apache.catalina.connector.Connector.startInternal(Connector.java:1020) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
  18. at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
  19. ... 13 common frames omitted
  20. Caused by: java.net.BindException: Address already in use: bind
  21. at sun.nio.ch.Net.bind0(Native Method) ~[na:1.8.0_161]
  22. at sun.nio.ch.Net.bind(Net.java:433) ~[na:1.8.0_161]
  23. at sun.nio.ch.Net.bind(Net.java:425) ~[na:1.8.0_161]
  24. at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) ~[na:1.8.0_161]
  25. at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) ~[na:1.8.0_161]
  26. at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:210) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
  27. at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:1150) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
  28. at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:591) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
  29. at org.apache.catalina.connector.Connector.startInternal(Connector.java:1018) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
  30. ... 14 common frames omitted
  31. 2018-06-26 20:48:00.990 INFO 15332 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
  32. 2018-06-26 20:48:00.997 INFO 15332 --- [ main] ConditionEvaluationReportLoggingListener :
  33. Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
  34. 2018-06-26 20:48:01.000 ERROR 15332 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
  35. ***************************
  36. APPLICATION FAILED TO START
  37. ***************************
  38. Description:
  39. The Tomcat connector configured to listen on port 8080 failed to start. The port may already be in use or the connector may be misconfigured.

解决

查看端口

执行一下命令查看所有端口和PID

  1. netstat -ano

在这里插入图片描述
太长了,只截取了有用部分。
根据PID,我们可以查找相应进程。

查找对应进程

  1. tasklist | findstr "10440"

查找如下:

在这里插入图片描述

杀死进程

执行一下指令:

  1. taskkill /f /t /im java.exe

此时再重新启动项目就可以了。

发表评论

表情:
评论列表 (有 0 条评论,61人围观)

还没有评论,来说两句吧...

相关阅读