同一个tomcat下部署多个个springboot的war包出现InstanceAlreadyExistsException异常

异常信息:

javax.management.InstanceAlreadyExistsException: com.alibaba.druid.filter.stat:name=statFilter,type=StatFilt

单个war包在tomcat下运行都正常,如果两个war同时部署,总是只有一个能正常运行。

从网上搜了很多,最后找到了解决方案:

springboot中:spring.jmx.default-domain 是默认打开的,两个war包MBean注册冲突。

有两种解决办法

办法1:spring.jmx.enabled=false

办法2:在application.properties中各自配置

spring.jmx.default-domain=project1

spring.jmx.default-domain=project2

目的区分,以保证domain是两个不一样的。

另外:因为我是copy一个项目出来  修改配置文件 启动的 

所以出现了另外个异常  web.xml 和pom.xml 中包名是否修改为项目名   


--------------------- 

原文: https://blog.csdn.net/sinat_30314715/article/details/79983054 
 

你可能感兴趣的:(同一个tomcat下部署多个个springboot的war包出现InstanceAlreadyExistsException异常)