Unable to register MBean [HikariDataSource (HikariPool-0)] with key 'dataSource'

后端 未结 7 1862
盖世英雄少女心
盖世英雄少女心 2021-02-01 03:21

I am getting below error in prod mode for (Java8+Oauth2+MySql+Hazelcast+no clustered http sessions) combination. Dev mode has worked fine.

Unable to register MBe         


        
7条回答
  •  野的像风
    2021-02-01 03:32

    Two things I tried and they worked for deploying two Hikari apps in the same tomcat are: Not only change poolName(1) but also change bean name for DataSource(2) Configuration.

    @Bean(destroyMethod = "shutdown")
    public DataSource dataSource2() {
    
        HikariConfig config = new HikariConfig();
        config.setPoolName("AARSHikaripool-1");
    

    Notice bean name is datasource2 while other app has datasource!!

    Update for JHipster:

    Since there is no datasource bean anymore, in application.yml add the following:

    spring:
        jmx:
            default-domain: [application_name]
    

提交回复
热议问题