Reputation: 469
i have a springboot webapp and when i deployed it on my server on tomcat 7.0.54 then i got following message in catalina.out
INFO: 2 Spring WebApplicationInitializers detected on classpath
and my application is deploying twice which casue Exception
org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to register MBean [inbound] with key 'inbound'; nested exception is javax.management.InstanceAlreadyExistsException
but i tried the same war file on my local system with tomcat 7.0.37 and the application works fine
any suggestion?
Thanks.
Upvotes: 6
Views: 27539
Reputation: 175
I had an identical situation. Spring Boot + Tomcat + InstanceAlreadyExistsException on a remote server but worked perfectly on my local Tomcat.
The cause was the remote server having two Host elements in server.xml pointing to the same Tomcat appBase directory (webapps.) That caused all webapps to be loaded twice. For some webapps it wasn't a problem, but for mine it was because it tried to register MBeans twice.
My solution was to replace one of the Host elements with an Alias under the other Host element. Now I just have one Host element and apps are loaded only once each.
Upvotes: 1
Reputation: 6532
I had the same issue. I removed compile("org.springframework.boot:spring-boot-actuator-docs")
from my gradle file and it worked.
Upvotes: 1
Reputation: 11
I had the same issue. I removed spring-boot-starter-thymeleaf
from my pom.xml
file and it worked. You may have a library in your classpath
which has another WebApplicationInitializer
.
Upvotes: 1