I am using Spring Boot in my Java application, and to deployment used Tomcat 7. I was trying to deploy multiple Spring Boot projects in the same server it showing exceptions
I think the jmx doesn't allow 2 beans with the same objectName to be created. You have 2 options.
environmentManager
(and any other duplicated bean) on one of the applications you are putting in the same containerIn my case, we need to have two of the same application online during updates before cutting over sessions to maintain 100% uptime. In this case, you cannot just specify a unique name (unless you update it for each potential deployment). Instead, I disabled jmx with the following setting in my application.yml file for all profiles:
spring:
jmx:
enabled: false
I think what happens when you deploy multiple Spring Boot applications is those apps try to register to jmx on the same jvm using the same name.
Check this issue for the solution https://github.com/spring-cloud/spring-cloud-config/issues/118
Copy-paste from DavidBiesack's solution
(regarding application.properties
or application.yaml
)
I was able to solve this by defining the following in my application.properties
spring.application.name=my-app-name
spring.jmx.default-domain=my-app-name
Or for application.yaml
:
spring:
application:
name: my-app-name
jmx:
default-domain: my-app-name