dynamic-tp icon indicating copy to clipboard operation
dynamic-tp copied to clipboard

spring cloud nacos项目启动报错

Open wtjperi2003 opened this issue 1 year ago • 4 comments

首先感谢您使用 DynamicTp,如果使用过程中有任何问题,请按照下述模板反馈问题,建议使用 Markdown 语法

版本信息

  • Jdk版本:11
  • SpringBoot版本:2.7.1
  • DynamicTp版本:1.1.0
  • 配置中心版本:spring-cloud-starter-alibaba-nacos-config:2021.0.4.0

问题描述

启动项目时直接报错,内容如下:

java.lang.IllegalStateException: Management-specific server address cannot be configured as the management server is not listening on a separate port
	at org.springframework.util.Assert.state(Assert.java:76) ~[spring-core-5.3.21.jar:5.3.21]
	at org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration$SameManagementContextConfiguration.verifyAddressConfiguration(ManagementContextAutoConfiguration.java:91) ~[spring-boot-actuator-autoconfigure-2.7.1.jar:2.7.1]
	at org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration$SameManagementContextConfiguration.afterSingletonsInstantiated(ManagementContextAutoConfiguration.java:77) ~[spring-boot-actuator-autoconfigure-2.7.1.jar:2.7.1]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:974) ~[spring-beans-5.3.21.jar:5.3.21]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.21.jar:5.3.21]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.21.jar:5.3.21]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.1.jar:2.7.1]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) ~[spring-boot-2.7.1.jar:2.7.1]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.1.jar:2.7.1]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-2.7.1.jar:2.7.1]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-2.7.1.jar:2.7.1]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-2.7.1.jar:2.7.1]
	at com.lead.cn.ConnectorApplication.main(ConnectorApplication.java:18) ~[classes/:na]
  • 配置文件:
         spring:
           dynamic:
             tp:
               enabled: true
               enabledCollect: false                    # 是否开启监控指标采集,默认false
               collectorTypes: logging      # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer
               logPath: /home/logs                     # 监控日志数据路径,默认 ${user.home}/logs,采集类型非logging不用配置
               monitorInterval: 5                      # 监控时间间隔(报警检测、指标采集),默认5s
               nacos:                                  # nacos配置,不配置有默认值(user-center-dev.yml这样)
                 dataId: connector-tp.yml       # 该配置文件的 dataId,如上述 user-center-dtp-dev.yml
                 group: DEFAULT_GROUP
               configType: yml                         # 配置文件类型
               platforms:                              # 通知报警平台配置
                 - platform: email
                   receivers: [email protected]   # 收件人
               executors:                                   # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量
                 - threadPoolName: receiverExecutor
                   threadPoolAliasName: 接收器线程池             # 线程池别名
                   executorType: common                     # 线程池类型common、eager:适用于io密集型
                   corePoolSize: 6
                   maximumPoolSize: 8
                   queueCapacity: 200
                   queueType: VariableLinkedBlockingQueue   # 任务队列,查看源码QueueTypeEnum枚举类
                   rejectedHandlerType: CallerRunsPolicy    # 拒绝策略,查看RejectedTypeEnum枚举类
                   keepAliveTime: 50
                   allowCoreThreadTimeOut: false                  # 是否允许核心线程池超时
                   threadNamePrefix: smart                         # 线程名前缀
                   waitForTasksToCompleteOnShutdown: false        # 参考spring线程池设计,优雅关闭线程池
                   awaitTerminationSeconds: 5                     # 单位(s)
                   preStartAllCoreThreads: false                  # 是否预热所有核心线程,默认false
                   runTimeout: 200                                # 任务执行超时阈值,目前只做告警用,单位(ms)
                   queueTimeout: 100                              # 任务在队列等待超时阈值,目前只做告警用,单位(ms)
                   taskWrapperNames: ["ttl", "mdc"]               # 任务包装器名称,继承TaskWrapper接口
                   notifyEnabled: true                            # 是否开启报警,默认true
                   notifyItems:                     # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警)
                     - type: capacity               # 报警项类型,查看源码 NotifyTypeEnum枚举类
                       enabled: true
                       threshold: 80                # 报警阈值
                       interval: 120                # 报警间隔(单位:s)
                     - type: change
                       enabled: true
                     - type: liveness
                       enabled: true
                       threshold: 80
                     - type: reject
                       enabled: true
                       threshold: 1
                     - type: run_timeout
                       enabled: true
                       threshold: 1
                     - type: queue_timeout
                       enabled: true
                       threshold: 1
    
    
  • 代码使用步骤:
  • 报错信息:
  • 猜测可能原因:

复现步骤

  1. xxx
  2. xxx

其他信息

  1. xxx
  2. xxx

wtjperi2003 avatar Mar 17 '23 02:03 wtjperi2003

你这问题看着不像是DynamicTp引起的吧

yanhom1314 avatar Mar 17 '23 06:03 yanhom1314

你这问题看着不像是DynamicTp引起的吧

我也很希望不是,很可惜,去掉dynamictp就正常

wtjperi2003 avatar Mar 18 '23 00:03 wtjperi2003

同问此问题

fushichenmu avatar Mar 20 '23 07:03 fushichenmu

https://github.com/spring-projects/spring-boot/issues/26362 我在spring-boot查了下有相关issue @wtjperi2003 @fushichenmu

KamToHung avatar Mar 21 '23 09:03 KamToHung