我有一个 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)。
Issue is resolved
Solution : Disable the default OpenJDK8 jolokia in Openshift
在本地
应用程序在Openshift Docker中没有以镜像的形式运行,而是在tomcat中以正常的spring boot应用程序的形式运行,所以我没有面临这个问题。
在Openshift中
应用以镜像的形式运行在openshift Docker中,镜像是以openJDK 8为基础创建的,默认启用了jolokia。红帽openshift参考
我已经通过覆盖它的 AB_JOLOKIA_OFF:true
中的openshift环境变量。
or either
如果您使用的是 maven fabric8 plugin
在pom中建立图像,然后你可以在pom中覆盖jolokia的属性(我还没有尝试,但它是可能的,根据 文件).