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 RetryingCacheInvoker ( 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 ) { ServiceName templateCacheServiceName = this . getCacheServiceName ( metaData . getReplicationConfig ( ) ) ; if ( ( registry . getService ( templateCacheServiceName ) ) == null ) { return false ; } String templateCacheName = templateCacheServiceName . getSimpleName ( ) ; ServiceName containerServiceName = templateCacheServiceName . getParent ( ) ; String containerName = containerServiceName . getSimpleName ( ) ; ServiceName templateCacheConfigurationServiceName = AbstractCacheConfigurationService . getServiceName ( containerName , templateCacheName ) ; String cacheName = ( deploymentServiceName . getParent ( ) . getSimpleName ( ) ) + ( deploymentServiceName . getSimpleName ( ) ) ; ServiceName cacheConfigurationServiceName = AbstractCacheConfigurationService . getServiceName ( containerName , cacheName ) ; ServiceName cacheServiceName = CacheService . getServiceName ( containerName , cacheName ) ; final InjectedValue < EmbeddedCacheManager > container = new InjectedValue < EmbeddedCacheManager > ( ) ; final InjectedValue < Configuration > config = new InjectedValue < Configuration > ( ) ; target . addService ( cacheConfigurationServiceName , new WebSessionCacheConfigurationService ( cacheName , container , config ) ) . addDependency ( containerServiceName , EmbeddedCacheManager . class , container ) . addDependency ( templateCacheConfigurationServiceName , Configuration . class , config ) . setInitialMode ( ON_DEMAND ) . install ( ) ; final InjectedValue < EmbeddedCacheManager > cacheContainer = new InjectedValue < EmbeddedCacheManager > ( ) ; CacheService . Dependencies dependencies = new CacheService . Dependencies ( ) { @ Override public EmbeddedCacheManager getCacheContainer ( ) { return cacheContainer . getValue ( ) ; } @ Override public XAResourceRecoveryRegistry getRecoveryRegistry ( ) { return null ; } } ; AsynchronousService . addService ( target , cacheServiceName , new CacheService < Object , Object > ( cacheName , dependencies ) ) . addDependency ( cacheConfigurationServiceName ) . addDependency ( containerServiceName , EmbeddedCacheManager . class , cacheContainer ) . addDependency ( OPTIONAL , ChannelService . getServiceName ( containerName ) ) . setInitialMode ( ON_DEMAND ) . install ( ) ; builder . addDependency ( cacheServiceName , Cache . class , this . cache ) ; builder . addDependency ( DistributedCacheManagerFactory . JVM_ROUTE_REGISTRY_SERVICE_NAME , Registry . class , this . registry ) ; <START_BUG> builder . addDependency ( SharedLocalYieldingClusterLockManagerService . getServiceName ( containerName ) , SharedLocalYieldingClusterLockManager . class , this . lockManager ) ; <END_BUG> builder . addDependency ( KeyAffinityServiceFactoryService . getServiceName ( containerName ) , KeyAffinityServiceFactory . class , this . affinityFactory ) ; return true ; } @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) @ Override public Collection < ServiceController < ? > > installServices ( ServiceTarget target ) { } 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:
builder . addDependency ( OPTIONAL , SharedLocalYieldingClusterLockManagerService . getServiceName ( containerName ) , SharedLocalYieldingClusterLockManager . class , this . lockManager ) ;