-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
9.4.18.Final
-
None
When retrieving the statistics of infinispan caches I get a NullPointerException at the following place:
java.lang.NullPointerException at org.infinispan@9.4.16.Final//org.infinispan.stats.impl.StatsImpl.<init>(StatsImpl.java:54) at org.infinispan@9.4.16.Final//org.infinispan.cache.impl.CacheImpl.getStats(CacheImpl.java:1405) at org.infinispan@9.4.16.Final//org.infinispan.cache.impl.AbstractDelegatingAdvancedCache.getStats(AbstractDelegatingAdvancedCache.java:301) at org.infinispan@9.4.16.Final//org.infinispan.stats.impl.CacheContainerStatsImpl.getStats(CacheContainerStatsImpl.java:617) at org.infinispan@9.4.16.Final//org.infinispan.stats.impl.CacheContainerStatsImpl.getRequiredMinimumNumberOfNodes(CacheContainerStatsImpl.java:138)
This is while accessing the statistics through the cachemanager through the code below:
@ApplicationScoped public class InfinispanService { @Resource(name = "java:comp/env/infinispan/hibernate/entity") private Cache<?, ?> entityCache; public void stats() { EmbeddedCacheManager cacheManager = entityCache.getCacheManager(); cacheManager.getStats().getRequiredMinimumNumberOfNodes(); } }
This is done in wildfly 19.0.1.Final, running using standalone.xml.
Obviously I'm digging into internals but probably this should not throw a NPE. The workaround is of course not calling getRequiredMinimumNumberOfNodes() (as in this particular case that is not configured IIUC).