I have a Spring Boot application that is deployed to an external Tomcat container (not using the embedded container), and am trying to get the actuator set up. The problem is that the management.port
in application.properties
does not seem to be honored by Tomcat. When I run Spring Boot with embedded Tomcat it works just fine.
For example, having the following set in application.properties
:
management.port=9010
Working endpoints for embedded container
http://localhost:9010/health
Non-working endpoints for external container running on port 8080
http://localhost:9010/health
http://localhost:8080/health
http://localhost:9010/<appName>/health
http://localhost:8080/<appName>/health
Is there a special configuration I need in the Tomcat container to expose a Spring Boot actuator end point?
I've tried setting an environment variable of MANAGEMENT_PORT
. Most (almost all) of the documentation available is using the embedded Tomcat, so tracking down this issue has proved to be challenging.
The third comment on this answer provided some possible insight: https://stackoverflow.com/a/28689853/2601060, which points to a GitHub file indicating that if the management port is not set, it will be the same as the server port.
We cannot specify an additional port with an external Tomcat container. Here is why : https://github.com/spring-projects/spring-boot/issues/552
The only way is to extend the endpoints using a context path, say "/management" and apply security on it.
Yes, if your application.properties is having property called "management.port: 9001" and "server.port: 9000". Then your application end-points will deploy on port 9000 and actuator end-points will deployed on port 9001.
So its up to us. We can mention both properties with same port, application will works correctly.
I had same issue in my local environement ,
:) hope it helps someone one day..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With