问题描述
我正在尝试在同一tomcat7实例上部署两个WAR文件(app1.war和app2.war).我收到此错误:
I am trying to deploye two WAR files (app1.war and app2.war) on the same tomcat7 instance. I am getting this error :
Unable to register MBean [HikariDataSource (HikariPool-0)] with key
'dataSource'; nested exception is javax.management.InstanceAlreadyExistsException:
com.zaxxer.hikari:name=dataSource,type=HikariDataSource
如果我在tomcat上仅部署了一个应用程序,则不会出现此错误.有办法解决这个问题吗?
I don't have this error if I have only one application deployed on tomcat.Is there a way to solve this issue?
推荐答案
在春季启动中,jmx bean在运行时加载并扫描您的应用程序.如果找到两个数据源,它将抛出javax.management.InstanceAlreadyExistsException.可以通过在application.properties文件中定义默认的jmx默认域名来解决此问题
in spring boot, jmx bean is loaded at run time and it scans your application. If two data sources are found, its going to throw javax.management.InstanceAlreadyExistsException. This can be resolved by defining the default jmx default domain name in your application.properties file as follows
spring.jmx.default-domain=app_name
我希望这会有所帮助.
这篇关于Tomcat:使用数据库连接部署两个应用程序时出现HikariCP问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!