5

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.

Rawat
  • 461
  • 3
  • 6
  • 23

3 Answers3

1

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.

vich
  • 11,836
  • 13
  • 49
  • 66
diver_cle
  • 11
  • 1
  • i tried with tomcat 7.0.75 and then started working thanks for the suggestion i will give a try – Rawat Mar 18 '17 at 04:35
1

I had the same issue. I removed compile("org.springframework.boot:spring-boot-actuator-docs") from my gradle file and it worked.

Kamil Nękanowicz
  • 6,254
  • 7
  • 34
  • 51
1

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.

John Gregg
  • 125
  • 1
  • 1
  • 8