Buggy code:
public class DistributedCacheManagerFactory implements org . jboss . as . clustering . web . DistributedCacheManagerFactory { public static final String DEFAULT_CACHE_CONTAINER = "web" ; public static final Short SCOPE_ID = Short . valueOf ( ( ( short ) ( 222 ) ) ) ; private final DistributedCacheManagerFactory . JvmRouteRegistryEntryProvider registryEntryProvider = new DistributedCacheManagerFactory . JvmRouteRegistryEntryProvider ( ) ; private SessionAttributeStorageFactory storageFactory = new SessionAttributeStorageFactoryImpl ( ) ; private CacheInvoker invoker = new RetryingCacheInvoker ( 10 , 100 ) ; private SessionAttributeMarshallerFactory marshallerFactory = new SessionAttributeMarshallerFactoryImpl ( ) ; @ SuppressWarnings ( "rawtypes" ) private final InjectedValue < Registry > registry = new InjectedValue < Registry > ( ) ; private final InjectedValue < EmbeddedCacheManager > container = new InjectedValue < EmbeddedCacheManager > ( ) ; private final InjectedValue < Configuration > config = new InjectedValue < Configuration > ( ) ; private final InjectedValue < SharedLocalYieldingClusterLockManager > lockManager = new InjectedValue < SharedLocalYieldingClusterLockManager > ( ) ; @ Override public < T extends OutgoingDistributableSessionData > org . jboss . as . clustering . web . DistributedCacheManager < T > getDistributedCacheManager ( LocalDistributableSessionManager manager ) throws ClusteringNotSupportedException { this . registryEntryProvider . setManager ( manager ) ; EmbeddedCacheManager container = this . container . getValue ( ) ; @ SuppressWarnings ( "unchecked" ) Registry < String , Void > jvmRouteRegistry = this . registry . getValue ( ) ; Configuration config = this . config . getValue ( ) ; if ( ! ( config . invocationBatching ( ) . enabled ( ) ) ) { ServiceName cacheServiceName = this . getCacheServiceName ( manager . getReplicationConfig ( ) ) ; throw new ClusteringNotSupportedException ( InfinispanWebMessages . MESSAGES . failedToConfigureWebApp ( cacheServiceName . getParent ( ) . getSimpleName ( ) , cacheServiceName . getSimpleName ( ) ) ) ; } String name = manager . getName ( ) ; ConfigurationBuilder builder = new ConfigurationBuilder ( ) . read ( config ) ; builder . storeAsBinary ( ) . enable ( ) . storeKeysAsBinary ( false ) . storeValuesAsBinary ( true ) ; container . defineConfiguration ( name , builder . build ( ) ) ; <START_BUG> AdvancedCache < String , Map < Object , Object > > sessionCache = container . < String , Map < Object , Object > > getCache ( name ) . getAdvancedCache ( ) . with ( this . getClass ( ) . getClassLoader ( ) ) ; <END_BUG> BatchingManager batchingManager = new org . jboss . as . clustering . web . impl . TransactionBatchingManager ( sessionCache . getTransactionManager ( ) ) ; SessionAttributeStorage < T > storage = this . storageFactory . createStorage ( manager . getReplicationConfig ( ) . getReplicationGranularity ( ) , this . marshallerFactory . createMarshaller ( manager ) ) ; return new DistributedCacheManager < T > ( manager , new org . jboss . as . clustering . infinispan . atomic . AtomicMapCache < String , Object , Object > ( sessionCache ) , jvmRouteRegistry , this . lockManager . getOptionalValue ( ) , storage , batchingManager , this . invoker ) ; } @ Override public boolean addDependencies ( ServiceRegistry registry , ServiceTarget target , ServiceBuilder < ? > builder , JBossWebMetaData metaData ) { } private ServiceName getCacheServiceName ( ReplicationConfig config ) { } public Injector < EmbeddedCacheManager > getCacheContainerInjector ( ) { } public Injector < Configuration > getCacheConfigurationInjector ( ) { } @ SuppressWarnings ( "rawtypes" ) public Injector < Registry > getRegistryInjector ( ) { } public Injector < SharedLocalYieldingClusterLockManager > getLockManagerInjector ( ) { } public void setSessionAttributeMarshallerFactory ( SessionAttributeMarshallerFactory marshallerFactory ) { } public void setSessionAttributeStorageFactory ( SessionAttributeStorageFactory storageFactory ) { } public void setCacheInvoker ( CacheInvoker invoker ) { } class JvmRouteRegistryEntryProvider implements RegistryEntryProvider < String , Void > { private volatile LocalDistributableSessionManager manager ; void setManager ( LocalDistributableSessionManager manager ) { } @ Override public String getKey ( ) { } @ Override public Void getValue ( ) { } } }

Fix:
AdvancedCache < String , Map < Object , Object > > sessionCache = container . < String , Map < Object , Object > > getCache ( name ) . getAdvancedCache ( ) ;