Buggy code:
public class DistributedCacheManagerFactory implements org . jboss . as . clustering . web . DistributedCacheManagerFactory { public static final String DEFAULT_CACHE_CONTAINER = "web" ; private static final ServiceName JVM_ROUTE_REGISTRY_SERVICE_NAME = JVM_ROUTE_REGISTRY_ENTRY_PROVIDER_SERVICE_NAME . getParent ( ) ; private SessionAttributeStorageFactory storageFactory = new SessionAttributeStorageFactoryImpl ( ) ; private CacheInvoker invoker = new org . jboss . as . clustering . infinispan . invoker . RetryingCacheInvoker ( new BatchCacheInvoker ( ) , 10 , 100 ) ; private SessionAttributeMarshallerFactory marshallerFactory = new SessionAttributeMarshallerFactoryImpl ( ) ; @ SuppressWarnings ( "rawtypes" ) private final InjectedValue < Registry > registry = new InjectedValue < Registry > ( ) ; private final InjectedValue < SharedLocalYieldingClusterLockManager > lockManager = new InjectedValue < SharedLocalYieldingClusterLockManager > ( ) ; @ SuppressWarnings ( "rawtypes" ) private final InjectedValue < Cache > cache = new InjectedValue < Cache > ( ) ; private final InjectedValue < KeyAffinityServiceFactory > affinityFactory = new InjectedValue < KeyAffinityServiceFactory > ( ) ; @ Override public < T extends OutgoingDistributableSessionData > org . jboss . as . clustering . web . DistributedCacheManager < T > getDistributedCacheManager ( LocalDistributableSessionManager manager ) throws ClusteringNotSupportedException { } @ Override public boolean addDeploymentDependencies ( ServiceName deploymentServiceName , ServiceRegistry registry , ServiceTarget target , ServiceBuilder < ? > builder , JBossWebMetaData metaData ) { } @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) @ Override public Collection < ServiceController < ? > > installServices ( ServiceTarget target ) { InjectedValue < Cache > cache = new InjectedValue < Cache > ( ) ; InjectedValue < Registry . RegistryEntryProvider > providerValue = new InjectedValue < Registry . RegistryEntryProvider > ( ) ; <START_BUG> ServiceController < ? > controller = target . addService ( DistributedCacheManagerFactory . JVM_ROUTE_REGISTRY_SERVICE_NAME , new org . jboss . as . clustering . registry . RegistryService ( cache , providerValue ) ) . addDependency ( CacheService . getServiceName ( DistributedCacheManagerFactory . DEFAULT_CACHE_CONTAINER , null ) , Cache . class , cache ) . addDependency ( JVM_ROUTE_REGISTRY_ENTRY_PROVIDER_SERVICE_NAME , RegistryEntryProvider . class , providerValue ) . setInitialMode ( ON_DEMAND ) . install ( ) ; <END_BUG> return Collections . < ServiceController < ? > > singleton ( controller ) ; } private ServiceName getCacheServiceName ( ReplicationConfig config ) { } @ SuppressWarnings ( "rawtypes" ) public Injector < Registry > getRegistryInjector ( ) { } public Injector < SharedLocalYieldingClusterLockManager > getLockManagerInjector ( ) { } @ SuppressWarnings ( "rawtypes" ) public Injector < Cache > getCacheInjector ( ) { } public void setSessionAttributeMarshallerFactory ( SessionAttributeMarshallerFactory marshallerFactory ) { } public void setSessionAttributeStorageFactory ( SessionAttributeStorageFactory storageFactory ) { } public void setCacheInvoker ( CacheInvoker invoker ) { } }

Fix:
ServiceController < ? > controller = AsynchronousService . addService ( target , DistributedCacheManagerFactory . JVM_ROUTE_REGISTRY_SERVICE_NAME , new org . jboss . as . clustering . registry . RegistryService ( cache , providerValue ) ) . addDependency ( CacheService . getServiceName ( DistributedCacheManagerFactory . DEFAULT_CACHE_CONTAINER , null ) , Cache . class , cache ) . addDependency ( JVM_ROUTE_REGISTRY_ENTRY_PROVIDER_SERVICE_NAME , RegistryEntryProvider . class , providerValue ) . setInitialMode ( ON_DEMAND ) . install ( ) ;