Buggy code:
public abstract class CacheAdd extends AbstractAddStepHandler { private static final Logger log = Logger . getLogger ( CacheAdd . class . getPackage ( ) . getName ( ) ) ; private static final String DEFAULTS = "infinispan-defaults.xml" ; private static volatile Map < CacheMode , Configuration > defaults = null ; public static synchronized Configuration getDefaultConfiguration ( CacheMode cacheMode ) { } private static ConfigurationBuilderHolder load ( String resource ) { } private static URL find ( String resource , ClassLoader ... loaders ) { } final CacheMode mode ; CacheAdd ( CacheMode mode ) { } @ Override protected void populateModel ( ModelNode operation , ModelNode model ) throws OperationFailedException { } @ Override protected void performRuntime ( OperationContext context , ModelNode operation , ModelNode model , ServiceVerificationHandler verificationHandler , List < ServiceController < ? > > newControllers ) throws OperationFailedException { } private < T > void addDependency ( ServiceBuilder < ? > builder , CacheAdd . Dependency < T > dependency ) { } abstract void populateCacheMode ( ModelNode fromModel , ModelNode toModel ) throws OperationFailedException { } void populate ( ModelNode fromModel , ModelNode toModel ) { } void processModelNode ( String containerName , ModelNode cache , ConfigurationBuilder builder , List < CacheAdd . Dependency < ? > > dependencies ) { } private String findStoreKey ( ModelNode cache ) { } private ModelNode getStoreModelNode ( ModelNode cache ) { } private void buildCacheStore ( LoaderConfigurationBuilder builder , String containerName , ModelNode store , String storeKey , List < CacheAdd . Dependency < ? > > dependencies ) { final Properties properties = new TypedProperties ( ) ; if ( store . hasDefined ( PROPERTY ) ) { for ( Property property : store . get ( PROPERTY ) . asPropertyList ( ) ) { String propertyName = property . getName ( ) ; Property complexValue = property . getValue ( ) . asProperty ( ) ; String propertyValue = complexValue . getValue ( ) . asString ( ) ; properties . setProperty ( propertyName , propertyValue ) ; } } builder . withProperties ( properties ) ; if ( storeKey . equals ( FILE_STORE ) ) { builder . cacheLoader ( new FileCacheStore ( ) ) ; final String path = ( store . hasDefined ( PATH ) ) ? store . get ( PATH ) . asString ( ) : containerName ; Injector < String > injector = new CacheAdd . SimpleInjector < String > ( ) { @ Override public void inject ( String value ) { StringBuilder location = new StringBuilder ( value ) ; if ( path != null ) { location . append ( File . separatorChar ) . append ( path ) ; } properties . setProperty ( "location" , location . toString ( ) ) ; } } ; String relativeTo = ( store . hasDefined ( RELATIVE_TO ) ) ? store . get ( RELATIVE_TO ) . asString ( ) : ServerEnvironment . SERVER_DATA_DIR ; dependencies . add ( new CacheAdd . Dependency < String > ( AbstractPathService . pathNameOf ( relativeTo ) , String . class , injector ) ) ; properties . setProperty ( "fsyncMode" , "perWrite" ) ; } else if ( storeKey . equals ( JDBC_STORE ) ) { builder . cacheLoader ( this . createJDBCStore ( properties , store ) ) ; String datasource = store . require ( DATASOURCE ) . asString ( ) ; <START_BUG> dependencies . add ( new CacheAdd . Dependency < Object > ( JBOSS . append ( "data-source" ) . append ( "reference-factory" ) . append ( datasource ) ) ) ; <END_BUG> properties . setProperty ( "datasourceJndiLocation" , datasource ) ; properties . setProperty ( "connectionFactoryClass" , ManagedConnectionFactory . class . getName ( ) ) ; } else if ( storeKey . equals ( REMOTE_STORE ) ) { builder . cacheLoader ( new RemoteCacheStore ( ) ) ; for ( ModelNode server : store . require ( REMOTE_SERVERS ) . asList ( ) ) { String outboundSocketBinding = server . get ( OUTBOUND_SOCKET_BINDING ) . asString ( ) ; Injector < OutboundSocketBinding > injector = new CacheAdd . SimpleInjector < OutboundSocketBinding > ( ) { @ Override public void inject ( OutboundSocketBinding value ) { try { String address = ( ( value . getDestinationAddress ( ) . getHostAddress ( ) ) + ":" ) + ( value . getDestinationPort ( ) ) ; String serverList = properties . getProperty ( "serverList" ) ; properties . setProperty ( "serverList" , ( serverList == null ? address : ( serverList + ";" ) + address ) ) ; } catch ( UnknownHostException e ) { throw MESSAGES . failedToInjectSocketBinding ( e , value ) ; } } } ; dependencies . add ( new CacheAdd . Dependency < OutboundSocketBinding > ( OUTBOUND_SOCKET_BINDING_BASE_SERVICE_NAME . append ( outboundSocketBinding ) , OutboundSocketBinding . class , injector ) ) ; } if ( store . hasDefined ( CACHE ) ) { properties . setProperty ( "remoteCacheName" , store . get ( CACHE ) . asString ( ) ) ; properties . setProperty ( "useDefaultRemoteCache" , Boolean . toString ( false ) ) ; } else { properties . setProperty ( "useDefaultRemoteCache" , Boolean . toString ( true ) ) ; } if ( store . hasDefined ( SOCKET_TIMEOUT ) ) { properties . setProperty ( "soTimeout" , store . require ( SOCKET_TIMEOUT ) . asString ( ) ) ; } if ( store . hasDefined ( TCP_NO_DELAY ) ) { properties . setProperty ( "tcpNoDelay" , store . require ( TCP_NO_DELAY ) . asString ( ) ) ; } } else { String className = store . require ( CLASS ) . asString ( ) ; try { CacheLoader loader = CacheLoader . class . getClassLoader ( ) . loadClass ( className ) . asSubclass ( CacheLoader . class ) . newInstance ( ) ; builder . cacheLoader ( loader ) ; }

Fix:
dependencies . add ( new CacheAdd . Dependency < Object > ( JBOSS . append ( "data-source" , datasource ) ) ) ;