尝试重新启动无法启动的CacheManager时,我收到此异常。
引起:org.infinispan.jmx.JmxDomainConflictException:ISPN000034:已经在'org.infinispan'JMX域下注册了JMX MBean实例type = CacheManager,name =“DefaultCacheManager”。如果要允许多个实例配置相同的JMX域,请在'globalJmxStatistics'配置元素中启用'allowDuplicateDomains'属性 在org.infinispan.jmx.JmxUtil.buildJmxDomain(JmxUtil.java:53)
我认为这是一个错误,但我是否正确?
使用的版本是9.0.0.Final。
修改
使用此代码段可以看到错误。
import org.infinispan.configuration.cache.*;
import org.infinispan.configuration.global.*;
import org.infinispan.manager.*;
class Main {
public static void main(String[] args) {
System.out.println("Starting");
GlobalConfigurationBuilder global = GlobalConfigurationBuilder.defaultClusteredBuilder();
global.transport()
.clusterName("discover-service-poc")
.initialClusterSize(3);
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.clustering().cacheMode(CacheMode.REPL_SYNC);
DefaultCacheManager cacheManager = new DefaultCacheManager(global.build(), builder.build(), false);
try {
System.out.println("Starting cacheManger first time.");
cacheManager.start();
} catch (Exception e) {
e.printStackTrace();
cacheManager.stop();
}
try {
System.out.println("Starting cacheManger second time.");
System.out.println("startAllowed: " + cacheManager.getStatus().startAllowed());
cacheManager.start();
System.out.println("Nothing happening because in failed state");
System.out.println("startAllowed: " + cacheManager.getStatus().startAllowed());
} catch (Exception e) {
e.printStackTrace();
cacheManager.stop();
}
cacheManager = new DefaultCacheManager(global.build(), builder.build(), false);
cacheManager.start();
}
}