在类路径上检测到 2 个 Spring WebApplicationInitializers

Raw*_*wat 6 spring-boot

我有一个 springboot web 应用程序,当我将其部署在 tomcat 7.0.54 上的服务器上时,我在 catalina.out 中收到以下消息

INFO: 2 Spring WebApplicationInitializers detected on classpath
Run Code Online (Sandbox Code Playgroud)

我的应用程序部署了两次,导致异常

org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to register MBean [inbound] with key 'inbound'; nested exception is javax.management.InstanceAlreadyExistsException
Run Code Online (Sandbox Code Playgroud)

但我在本地系统上使用 tomcat 7.0.37 尝试了相同的 war 文件,并且该应用程序工作正常

有什么建议吗?

谢谢。

小智 1

我遇到过同样的问题。我spring-boot-starter-thymeleaf从我的pom.xml文件中删除并且它起作用了。您的图书馆中可能有classpath另一个WebApplicationInitializer.