Could you please tell us more about they way you are deploying your application? I'm assuming you use an Application Server (a Wildfly instance?). It might be also important which libraries are packed into your deployment.
It might be possible that you encounter some error with our CDI integration bits (if they are enabled, our extension tries to inject Cache instances where needed). You might find some blogs describing how does work:
ejb service as a singleton with startup annotation, wildfly 8.2.1 standalone instance
Looks like you're hitting [ISPN-4659] DefaultCacheManager.stop() is not removing the GlobalComponentRegistry JMX domain, indeed. It was fixed in Infinispan 8.2.0.Final, but your workaround should also be fine if you can't upgrade.
Note that removeCache(someCacheName) will remove the cache on all the cluster nodes, if the cache manager is clustered. It's also not necessary, the cache manager handles regular caches properly. So this workaround should be more correct:
ok, it looks good, i'll try to upgrade Infinispan to 8.2 in this case for our cluster (replicatated cache), we're starting to use Wildfly 10 (there is Infinispan 8.1) slowly and I think it should be possible without major problems. Also I'll try to stop the cache manager like you mentioned: CACHE_MANAGER.getCache("__cluster_registry_cache__(repl_sync)").stop();
thanks a lot