首页 > 解决方案 > Jolokia 端点在开放式换档中不通过弹簧靴执行器暴露

问题描述

我有一个camel application which is running in spring boot 2和骆驼路线是通过可视化的hawtio。和all actuator endpoints are exposed including jolokia endpoint

this application is completely working in local当我尝试在本地访问执行器端点时http://localhost:8080/actuator/,我可以看到下面的端点以及其他 16 个端点(例如健康、信息等)

"jolokia": {
"href": "http://localhost:8080/actuator/jolokia",
"templated": false
}

我有deployed the in same Openshift,但是当我尝试时,access actuator endpoints in Openshift 我可以看到only 16 endpoints without jolokia endpoint

应用程序启动登录local

INFO : Initializing Spring embedded WebApplicationContext
INFO : Root WebApplicationContext: initialization completed in 3543 ms
INFO : Registered '/actuator/jolokia' to jolokia-actuator-endpoint
INFO : Initialising hawtio services
INFO : Configuration will be discovered via system properties
INFO : Welcome to Hawtio 2.10.0
INFO : Starting hawtio authentication filter, JAAS authentication disabled
INFO : Initializing ExecutorService 'applicationTaskExecutor'
INFO : Detected and using LURCacheFactory: camel-caffeine-lrucache
INFO : Exposing 17 endpoint(s) beneath base path '/actuator'

应用程序启动登录Openshift

INFO : Initializing Spring embedded WebApplicationContext
INFO : Root WebApplicationContext: initialization completed in 3543 ms

INFO : Initialising hawtio services
INFO : Configuration will be discovered via system properties
INFO : Welcome to Hawtio 2.10.0
INFO : Starting hawtio authentication filter, JAAS authentication disabled
INFO : Initializing ExecutorService 'applicationTaskExecutor'
INFO : Detected and using LURCacheFactory: camel-caffeine-lrucache
INFO : Exposing 16 endpoint(s) beneath base path '/actuator'

INFO : Registered '/actuator/jolokia' to jolokia-actuator-endpoint日志中缺少Openshift,所以很明显它没有注册spring boot actuator

有什么想法why jolokia is not exposed via spring boot actuator吗?

因此hawtio无法访问骆驼路线(JMX)。

标签: openshiftspring-boot-actuatorhawtiojolokiaspring-boot-2

解决方案


Issue is resolved Solution : Disable the default OpenJDK8 jolokia in Openshift

在本地

应用程序没有在 Openshift / Docker 中作为映像运行,在 tomcat 中作为正常的 Spring Boot 应用程序运行,所以我没有遇到这个问题。

在 Openshift 中

应用程序作为镜像实例在 openshift / Docker 中运行。该映像是使用基础 openJDK 8 创建的,该基础 openJDK 8 默认启用了 jolokia Red hat openshift 参考

我通过AB_JOLOKIA_OFF:true在 openshift 环境变量中覆盖它来禁用它。

or either如果您maven fabric8 plugin在 pom 中使用来构建图像,那么您可以在 pom 本身中覆盖它的 jolokia 属性(我没有尝试过,但它可以根据文档进行)。

环境变量

OpenJDK 8 的默认 Jolokia


推荐阅读