Spring Boot 运行时出现tomcat端口占用问题

在Spring Boot项目启动时遇到8080端口被占用的问题,通过在终端查找并结束占用该端口的进程(如javaw.exe),然后重启项目,即可解决端口冲突,确保顺利运行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在Spring Boot 中启动项目模块时,报错:

 ERROR 1204 --- [           main] org.apache.catalina.util.LifecycleBase   : Failed to start component [Connector[HTTP/1.1-8070]]


***************************
APPLICATION FAILED TO START
***************************

Description:

The Tomcat connector configured to listen on port 8070 failed to start. The port may already be in use or the connector may be misconfigured.

Action:

Verify the connector's configuration, identify and stop any process that's listening on port 8070, or configure this application to listen on another port.

报错说tomcat的8080端口被占用

怎么办呢?

在终端将占用8080端口的进程结束后项目正常启动了!

方法如下:

  1. 打开cmd终端,查看所有端口和PID
netstat -ano
  1. 找出占用8080端口的进程
    找到占用8080端口的进程
  2. 找到对应的端口对应的PID 输入指令找到对应的进程
 tasklist | findstr "12112"

此时会显示进程的名字
我这里的进程是 javaw.exe

  1. 输入指令结束该进程
  taskkill /f /t /im javaw.exe 

成功后重启项目,运行成功

2019-07-02 11:39:12.442  INFO 10712 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$e403c324] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.6.RELEASE)

2019-07-02 11:39:13.027  INFO 10712 --- [           main] o.s.c.a.n.c.NacosPropertySourceBuilder   : Loading nacos data, dataId: 'service-provider-config.yaml', group: 'DEFAULT_GROUP'
2019-07-02 11:39:13.086  INFO 10712 --- [           main] b.c.PropertySourceBootstrapConfiguration : Located property source: CompositePropertySource {name='NACOS', propertySources=[NacosPropertySource {name='service-provider-config.yaml'}]}
2019-07-02 11:39:13.091  INFO 10712 --- [           main] c.y.s.c.a.provider.ProviderApplication   : No active profile set, falling back to default profiles: default
2019-07-02 11:39:13.905  WARN 10712 --- [           main] o.s.boot.actuate.endpoint.EndpointId     : Endpoint ID 'nacos-config' contains invalid characters, please migrate to a valid format.
2019-07-02 11:39:13.909  WARN 10712 --- [           main] o.s.boot.actuate.endpoint.EndpointId     : Endpoint ID 'nacos-discovery' contains invalid characters, please migrate to a valid format.
2019-07-02 11:39:13.954  WARN 10712 --- [           main] o.s.boot.actuate.endpoint.EndpointId     : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format.
2019-07-02 11:39:14.133  INFO 10712 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=f179c33f-e01f-3f38-bb60-7544077fbd90
2019-07-02 11:39:14.176  INFO 10712 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$e403c324] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-07-02 11:39:14.447  INFO 10712 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8070 (http)
2019-07-02 11:39:14.474  INFO 10712 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-07-02 11:39:14.474  INFO 10712 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.21]
2019-07-02 11:39:14.481  INFO 10712 --- [           main] o.a.catalina.core.AprLifecycleListener   : Loaded APR based Apache Tomcat Native library [1.2.21] using APR version [1.6.5].
2019-07-02 11:39:14.482  INFO 10712 --- [           main] o.a.catalina.core.AprLifecycleListener   : APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
2019-07-02 11:39:14.482  INFO 10712 --- [           main] o.a.catalina.core.AprLifecycleListener   : APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
2019-07-02 11:39:14.486  INFO 10712 --- [           main] o.a.catalina.core.AprLifecycleListener   : OpenSSL successfully initialized [OpenSSL 1.1.1a  20 Nov 2018]
2019-07-02 11:39:14.629  INFO 10712 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-07-02 11:39:14.629  INFO 10712 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1518 ms
2019-07-02 11:39:15.547  WARN 10712 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2019-07-02 11:39:15.548  INFO 10712 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-07-02 11:39:15.552  WARN 10712 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2019-07-02 11:39:15.552  INFO 10712 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-07-02 11:39:15.773  INFO 10712 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-07-02 11:39:16.120  INFO 10712 --- [           main] o.s.s.c.ThreadPoolTaskScheduler          : Initializing ExecutorService
2019-07-02 11:39:16.492  INFO 10712 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 21 endpoint(s) beneath base path '/actuator'
2019-07-02 11:39:16.644  INFO 10712 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8070 (http) with context path ''
2019-07-02 11:39:16.710  INFO 10712 --- [           main] o.s.c.a.n.registry.NacosServiceRegistry  : nacos registry, service-provider 10.3.136.4:8070 register finished
2019-07-02 11:39:16.714  INFO 10712 --- [           main] c.y.s.c.a.provider.ProviderApplication   : Started ProviderApplication in 6.411 seconds (JVM running for 7.816)
2019-07-02 11:39:17.101  INFO 10712 --- [68.116.129_8848] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$e403c324] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-07-02 11:39:17.494  INFO 10712 --- [68.116.129_8848] o.s.c.a.n.c.NacosPropertySourceBuilder   : Loading nacos data, dataId: 'service-provider-config.yaml', group: 'DEFAULT_GROUP'
2019-07-02 11:39:17.497  INFO 10712 --- [68.116.129_8848] b.c.PropertySourceBootstrapConfiguration : Located property source: CompositePropertySource {name='NACOS', propertySources=[NacosPropertySource {name='service-provider-config.yaml'}]}
2019-07-02 11:39:17.502  INFO 10712 --- [68.116.129_8848] o.s.boot.SpringApplication               : No active profile set, falling back to default profiles: default
2019-07-02 11:39:17.525  INFO 10712 --- [68.116.129_8848] o.s.boot.SpringApplication               : Started application in 0.768 seconds (JVM running for 8.627)
2019-07-02 11:39:17.545  INFO 10712 --- [n(3)-10.3.136.4] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2019-07-02 11:39:17.545  INFO 10712 --- [n(3)-10.3.136.4] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2019-07-02 11:39:17.559  INFO 10712 --- [n(3)-10.3.136.4] o.s.web.servlet.DispatcherServlet        : Completed initialization in 14 ms
2019-07-02 11:39:17.749  INFO 10712 --- [68.116.129_8848] o.s.c.e.event.RefreshEventListener       : Refresh keys changed: []

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值