Multiple Spring-boot applications running on the same Tomcat

Can I have two (or more) Spring-boot applications running on the same Tomcat?

I have two applications packaged in files war, and I would like to run them on the same Tomcat server. However, when deploying them, I get the following exception:

org.springframework.jmx.export.UnableToRegisterMBeanException: 
    Unable to register MBean [org.springframework.boot.actuate.endpoint.jmx.DataEndpointMBean@2361d8ee] with key 'dumpEndpoint'; 
    nested exception is javax.management.InstanceAlreadyExistsException: org.springframework.boot:type=Endpoint,name=dumpEndpoint

The default endpoints that each Spring-boot application registers (e.g. / health, etc.) conflict. Is there any solution for this or is it impossible to complete this setup?

Thanks for any answers!

+7
source share
3 answers

As stated in the Spring Boot Reference :

Spring ApplicationContext, , . , endpoints.jmx.uniqueNames true, MBean .

endpoints.jmx.domain=myapp
endpoints.jmx.uniqueNames=true
+9

@Maciej .

spring.application.name=my-app-name
spring.jmx.default-domain=my-app-name

application.yaml:

spring:
  application:
    name: my-app-name
  jmx:
    default-domain: my-app-name

Spring boot 1.5.9.RELEASE

+5
spring.jmx.default-domain=app-name
spring.jmx.unique-names=true
0
source

Source: https://habr.com/ru/post/1609908/


All Articles