admin 启动失败:creating 'cookieStoreCleanupTrigger' defined in class path resource

来源:5-1 搭建 SpringBoot Admin 监控服务器

惜福7840346

2021-08-26

1-idea ui 版本 2021.2
2-由于 idea 版本问题,之前运行报错百度了,然后就升级了 引用jar 包的版本,nacos-client 运行OK

  • lombok: 1.16.18 =>1.18.20
  • commons-lang3: 3.11 => 3.12.0
  • hutool-all: 5.6.0 =>5.7.9
  • jjwt-api: 0.10.5 => 0.11.2
  • jjwt-impl: 0.10.5 => 0.11.2
  • jjwt-jackson: 0.10.5 => 0.11.2
  • fastjson: 1.2.47 => 1.2.78
  • spring-cloud-starter-alibaba-nacos-discovery: 2.2.3.RELEASE => 2021.1
  • spring-kafka: 2.5.0.RELEASE => 2.7.6
  • feign-gson: 11.0 => 11.5

3- admin 的jar 包也做了对应升级

  • spring-cloud-starter-alibaba-nacos-discovery: 2.2.3.RELEASE => 2021.1

bootstrap.yml 配置 :

server:
  port: 7001
  servlet:
    context-path: /ecommerce-admin

spring:
  application:
    name: ecommerce-admin
 # security:
 #   user:
 #     name: imooc-qinyi
 #     password: 88888888
  cloud:
    nacos:
      discovery:
        enabled: true
        # server-addr: 127.0.0.1:8848
        server-addr: 192.168.1.193:8848,192.168.1.193:8858,192.168.1.193:8868 # Nacos 服务器地址
        namespace: 6fe714cd-b888-42fc-a59e-24067c481b04
        metadata:
          management:
            context-path: ${server.servlet.context-path}/actuator
          # user.name: imooc-qinyi
          # user.password: 88888888
  thymeleaf:
    check-template: false
    check-template-location: false
  # 被监控的应用状态变更为 DOWN、OFFLINE、UNKNOWN 时, 会自动发出告警: 实例的状态、原因、实例地址等信息
  # 需要在 pom.xml 文件中添加 spring-boot-starter-mail 依赖
  # 配置发送告警的邮箱服务器
  # 但是, 这个要能连接上, 否则会报错
  #  mail:
  #    host: qinyi.imooc.com
  #    username: qinyi@imooc.com
  #    password: QinyiZhang
  #    default-encoding: UTF-8
  # 监控告警通知
#  boot:
#    admin:
#      notify:
#        mail:
#          from: ${spring.mail.username}
#          to: qinyi@imooc.com
#          cc: qinyi@imooc.com

# 暴露端点
management:
  endpoints:
    web:
      exposure:
        include: '*'  # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 *, 可以开放所有端点
  endpoint:
    health:
      show-details: always

bootstrap.properties 配置 :

#nacos config
spring.cloud.nacos.config.server-addr=192.168.1.193:8848
spring.application.name=ecommerce-admin

AdminApplication 代码 :

package com.cnlyra.commerce;

import de.codecentric.boot.admin.server.config.EnableAdminServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * <h1>监控中心服务器启动入口</h1>
 */
@EnableAdminServer
@SpringBootApplication
public class AdminApplication {

    public  static  void main(String[] args){
        SpringApplication.run(AdminApplication.class,args);
    }
}

错误信息:

WARN 33544 --- [ main] o.s.boot.actuate.endpoint.EndpointId     : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format.
 WARN 33544 --- [main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cookieStoreCleanupTrigger' defined in class path resource [de/codecentric/boot/admin/server/config/AdminServerInstanceWebClientConfiguration$CookieStoreConfiguration.class]: Unsatisfied dependency expressed through method 'cookieStoreCleanupTrigger' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventStore' defined in class path resource [de/codecentric/boot/admin/server/config/AdminServerAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [de.codecentric.boot.admin.server.eventstore.InMemoryEventStore]: Factory method 'eventStore' threw exception; nested exception is java.lang.NoClassDefFoundError: reactor/core/publisher/Sinks$EmitResult

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-08-26 11:22:45.038 ERROR 33544 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cookieStoreCleanupTrigger' defined in class path resource [de/codecentric/boot/admin/server/config/AdminServerInstanceWebClientConfiguration$CookieStoreConfiguration.class]: Unsatisfied dependency expressed through method 'cookieStoreCleanupTrigger' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventStore' defined in class path resource [de/codecentric/boot/admin/server/config/AdminServerAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [de.codecentric.boot.admin.server.eventstore.InMemoryEventStore]: Factory method 'eventStore' threw exception; nested exception is java.lang.NoClassDefFoundError: reactor/core/publisher/Sinks$EmitResult
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:797) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:538) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:893) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) ~[spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) ~[spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) ~[spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
	at com.cnlyra.commerce.AdminApplication.main(AdminApplication.java:15) ~[classes/:na]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventStore' defined in class path resource [de/codecentric/boot/admin/server/config/AdminServerAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [de.codecentric.boot.admin.server.eventstore.InMemoryEventStore]: Factory method 'eventStore' threw exception; nested exception is java.lang.NoClassDefFoundError: reactor/core/publisher/Sinks$EmitResult
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:655) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:483) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1304) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1224) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:884) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:788) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	... 20 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [de.codecentric.boot.admin.server.eventstore.InMemoryEventStore]: Factory method 'eventStore' threw exception; nested exception is java.lang.NoClassDefFoundError: reactor/core/publisher/Sinks$EmitResult
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:650) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	... 34 common frames omitted
Caused by: java.lang.NoClassDefFoundError: reactor/core/publisher/Sinks$EmitResult
	at de.codecentric.boot.admin.server.eventstore.InstanceEventPublisher.<init>(InstanceEventPublisher.java:38) ~[spring-boot-admin-server-2.5.1.jar:2.5.1]
	at de.codecentric.boot.admin.server.eventstore.ConcurrentMapEventStore.<init>(ConcurrentMapEventStore.java:54) ~[spring-boot-admin-server-2.5.1.jar:2.5.1]
	at de.codecentric.boot.admin.server.eventstore.InMemoryEventStore.<init>(InMemoryEventStore.java:38) ~[spring-boot-admin-server-2.5.1.jar:2.5.1]
	at de.codecentric.boot.admin.server.eventstore.InMemoryEventStore.<init>(InMemoryEventStore.java:34) ~[spring-boot-admin-server-2.5.1.jar:2.5.1]
	at de.codecentric.boot.admin.server.config.AdminServerAutoConfiguration.eventStore(AdminServerAutoConfiguration.java:139) ~[spring-boot-admin-server-2.5.1.jar:2.5.1]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	... 35 common frames omitted
Caused by: java.lang.ClassNotFoundException: reactor.core.publisher.Sinks$EmitResult
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) ~[na:na]
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na]
	... 45 common frames omitted

2021-08-26 11:22:45.039  WARN 33544 --- [     Thread-460] c.a.nacos.common.notify.NotifyCenter     : [NotifyCenter] Start destroying Publisher
2021-08-26 11:22:45.039  WARN 33544 --- [     Thread-454] c.a.n.common.http.HttpClientBeanHolder   : [HttpClientBeanHolder] Start destroying common HttpClient
2021-08-26 11:22:45.040  WARN 33544 --- [     Thread-460] c.a.nacos.common.notify.NotifyCenter     : [NotifyCenter] Destruction of the end
2021-08-26 11:22:45.040  WARN 33544 --- [     Thread-454] c.a.n.common.http.HttpClientBeanHolder   : [HttpClientBeanHolder] Destruction of the end

Process finished with exit code 1

请问这是什么原因造成的?

写回答

1回答

惜福7840346

提问者

2021-08-26

处理办法:

  1. 开始升级 org.springframework.boot 到 5.4.0 运行 nacos-client, admin 都报错,然后改成 2.3.12.RELEASE 也是报错

  2. 我就去maven 仓库查看 org.springframework.boot  2.3.1.RELEASE 大概是什么时候发布的,然后去找 spring-boot-admin-starter-server 的版本信息,找了一个和 boot 大概同一个时间发布的版本(2.2.4)就解决了问题,老师给的版本是2.5.0

1
0

Spring Cloud / Alibaba 微服务架构实战

从架构设计到开发实践,手把手实现

1213 学习 · 674 问题

查看课程