gpt4 book ai didi

java - SpringBoot 2.0.5应用程序启动后失败

转载 作者:行者123 更新时间:2023-12-02 10:38:46 24 4
gpt4 key购买 nike

我正在将我的应用程序从 Spring 1.5.x 升级到 Spring 2.0.5。虽然所有步骤都已完成并且所需的模块也已升级,但应用程序成功启动,但在 30-40 秒后突然失败。奇怪的是,没有报告任何错误。只需以下几行:

[INFO] AnnotationConfigServletWebServerApplicationContext - Closing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6b26e945: startup date [Wed Oct 31 12:23:59 GMT 2018]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@5f9d02cb
[INFO] DefaultLifecycleProcessor - Stopping beans in phase 2147483647
[INFO] DefaultLifecycleProcessor - Stopping beans in phase 2147483547
[INFO] DefaultLifecycleProcessor - Stopping beans in phase 0
[INFO] EventDrivenConsumer - Removing {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
[INFO] PublishSubscribeChannel - Channel 'filterprocessor-1.errorChannel' has 0 subscriber(s).
[INFO] EventDrivenConsumer - stopped _org.springframework.integration.errorLogger
[INFO] ThreadPoolTaskScheduler - Shutting down ExecutorService 'taskScheduler'
[INFO] IntegrationMBeanExporter - Unregistering JMX-exposed beans on shutdown
[INFO] IntegrationMBeanExporter - Unregistering JMX-exposed beans
[INFO] IntegrationMBeanExporter - Summary on shutdown: errorChannel
[INFO] IntegrationMBeanExporter - Summary on shutdown: nullChannel
[INFO] IntegrationMBeanExporter - Summary on shutdown: _org.springframework.integration.errorLogger.handler
[INFO] AnnotationMBeanExporter - Unregistering JMX-exposed beans on shutdown
[INFO] AnnotationMBeanExporter - Unregistering JMX-exposed beans
[INFO] ThreadPoolTaskExecutor - Shutting down ExecutorService 'appShellThreadPoolTaskExecutor'

看来AnnotationConfigServletWebServerApplicationContext是在Spring 2.0.x中引入的,这与失败有关。第二个想法是 tomcat,但后来我已经添加了这个依赖项:

compile 'org.springframework.boot:spring-boot-starter-web'

编辑:发布我的 build.gradle

    dependencies {
compileOnly(
"org.projectlombok:lombok:1.18.+",
)
compile 'org.springframework.boot:spring-boot-starter-web'
compile(
"org.springframework.boot:spring-boot-starter",
"org.springframework.cloud:spring-cloud-stream-reactive",
"org.springframework.boot:spring-boot-starter-hateoas",
//"org.springframework.cloud:spring-cloud-starter-eureka",
"io.projectreactor:reactor-core:3.2.2.RELEASE",
)
compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-kubernetes-all', version: '0.3.0.RELEASE'
//compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-feign:', version:'1.4.0.RELEASE'
compile('org.springframework.cloud:spring-cloud-starter-sleuth')
compile group: 'com.google.guava', name: 'guava', version: '23.0'
compile group: 'org.springframework.data', name: 'spring-data-commons', version: '2.0.2.RELEASE'
testCompile group: 'ru.yandex.qatools.allure', name: 'allure-junit-adaptor', version: '1.5.4'


testCompile("org.springframework.boot:spring-boot-starter-test") {
exclude group : "junit" , module : "junit"
}

testCompile(
"org.springframework.cloud:spring-cloud-stream-test-support",
"org.skyscreamer:jsonassert:1.5.+",

'org.junit.jupiter:junit-jupiter-api',
)
testRuntimeOnly(
'org.junit.jupiter:junit-jupiter-engine',
)
testRuntime(
'org.junit.platform:junit-platform-launcher',
'org.junit.platform:junit-platform-runner',
)

testCompileOnly (
"org.projectlombok:lombok:1.18.+",
)

}

dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-dependencies:2.0.3.RELEASE"
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Finchley.RELEASE"
mavenBom "org.springframework.cloud.stream.app:app-starters-core-dependencies:2.0.1.RELEASE"
mavenBom "org.junit:junit-bom:5.3.1"
}
}
configurations.all {
exclude group: 'org.slf4j', module: 'slf4j-simple'
exclude group: "com.sun.jdmk", module: 'jmxtools'
exclude group: "com.sun.jmx", module: 'jmxri'
}

最佳答案

这是 Spring Actuator HealthPoint 的问题。之前的健康点是:/manage/health

在 Spring 2.0.x 中,它更改为/actuator/health

我的 Kubernetes 活力探测器正在尝试访问该 URL。 3 次尝试访问/manage/health 失败导致 POD 下降。

将白名单从/actuator/health 更改为/actuator/health 并且有效

关于java - SpringBoot 2.0.5应用程序启动后失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53083634/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com