在同一个tomcat下部署2个springboot的war包出现InstanceAlreadyExistsException错误

在同一个tomcat下部署两个springboot的war包时会出现以下错误:

org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to register MBean [com.alibaba.druid.filter.stat.StatFilter@501c1218] with key 'statFilter'; nested exception is javax.management.InstanceAlreadyExistsException: com.alibaba.druid.filter.stat:name=statFilter,type=StatFilter

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

有两种解决方案:

方案1:在application.yml配置文件中各自添加配置:

spring.jmx.enabled=false

方案2:在application.yml中各自配置:

spring.jmx.default-domain=project1

spring.jmx.default-domain=project2

发布了35 篇原创文章 · 获赞 33 · 访问量 4950

猜你喜欢

转载自blog.csdn.net/wkw1598727534/article/details/92569436
今日推荐