我正在将我的应用程序从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'
似乎在Spring 2.0.x中引入了AnnotationConfigServletWebServerApplicationContext,这在失败时有所作为。第二个想法是关于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'
}
答案 0 :(得分:1)
这是Spring Actuator HealthPoint的问题。 先前的健康点是:// manage / health
在Spring 2.0.x中,将其更改为/ actuator / health
我的Kubernetes生动性调查试图访问URL。 3次未能成功达到/ manage / health的尝试导致POD下降。
将白名单从/ actuator / health更改为有效