Buggy code:
public class DsDeploymentProcessor implements DeploymentUnitProcessor { public static final Logger log = Logger . getLogger ( "org.jboss.as.connector.deployer.dsdeployer" ) ; public DsDeploymentProcessor ( ) { } public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; final ConnectorXmlDescriptor connectorXmlDescriptor = deploymentUnit . getAttachment ( ATTACHMENT_KEY ) ; <START_BUG> Module module = phaseContext . getAttachment ( MODULE ) ; <END_BUG> String deploymentName = ( connectorXmlDescriptor == null ) ? null : connectorXmlDescriptor . getDeploymentName ( ) ; DataSources datasources = DataSourcesAttachement . getDataSourcesAttachment ( deploymentUnit ) ; if ( ( ( datasources == null ) || ( deploymentName == null ) ) || ( ! ( deploymentName . startsWith ( "jdbc" ) ) ) ) return ; DsDeploymentProcessor . log . tracef ( "Processing<seq2seq4repair_space>datasource<seq2seq4repair_space>deployement:<seq2seq4repair_space>%s" , datasources ) ; if ( module == null ) throw new DeploymentUnitProcessingException ( ( "Failed<seq2seq4repair_space>to<seq2seq4repair_space>get<seq2seq4repair_space>module<seq2seq4repair_space>attachment<seq2seq4repair_space>for<seq2seq4repair_space>" + deploymentUnit ) ) ; String uniqueJdbcLocalId = null ; String uniqueJdbcXAId = null ; boolean shouldDeploy = false ; if ( ( deploymentName . indexOf ( "local" ) ) != ( - 1 ) ) { List < DataSource > dss = datasources . getDataSource ( ) ; if ( ( dss != null ) && ( ( dss . size ( ) ) > 0 ) ) { uniqueJdbcLocalId = deploymentName ; shouldDeploy = true ; } } else { List < XaDataSource > xadss = datasources . getXaDataSource ( ) ; if ( ( xadss != null ) && ( ( xadss . size ( ) ) > 0 ) ) { uniqueJdbcXAId = deploymentName ; shouldDeploy = true ; } } if ( shouldDeploy ) { final ServiceTarget serviceTarget = phaseContext . getServiceTarget ( ) ; final DataSourceDeploymentService dataSourceDeploymentService = new DataSourceDeploymentService ( deploymentName , uniqueJdbcLocalId , uniqueJdbcXAId , datasources , module ) ; ServiceBuilder < ? > serviceBuilder = serviceTarget . addService ( SERVICE_NAME_BASE . append ( deploymentName ) , dataSourceDeploymentService ) . addDependency ( IRONJACAMAR_MDR , MetadataRepository . class , dataSourceDeploymentService . getMdrInjector ( ) ) . addDependency ( RESOURCE_ADAPTER_REGISTRY_SERVICE , ResourceAdapterDeploymentRegistry . class , dataSourceDeploymentService . getRegistryInjector ( ) ) . addDependency ( JNDI_STRATEGY_SERVICE , JndiStrategy . class , dataSourceDeploymentService . getJndiInjector ( ) ) . addDependency ( JBOSS_TXN_ARJUNA_TRANSACTION_MANAGER , TransactionManagerService . class , dataSourceDeploymentService . getTxmInjector ( ) ) . addDependency ( SERVICE_NAME ) . setInitialMode ( ACTIVE ) ; if ( uniqueJdbcLocalId != null ) { serviceBuilder . addDependency ( OPTIONAL , RESOURCE_ADAPTER_SERVICE_PREFIX . append ( uniqueJdbcLocalId ) ) ; serviceBuilder . addDependency ( OPTIONAL , RESOURCE_ADAPTER_XML_SERVICE_PREFIX . append ( uniqueJdbcLocalId ) ) ; } else if ( uniqueJdbcXAId != null ) { serviceBuilder . addDependency ( OPTIONAL , RESOURCE_ADAPTER_SERVICE_PREFIX . append ( uniqueJdbcXAId ) ) ; serviceBuilder . addDependency ( OPTIONAL , RESOURCE_ADAPTER_XML_SERVICE_PREFIX . append ( uniqueJdbcXAId ) ) ; } serviceBuilder . install ( ) ; } } public void undeploy ( DeploymentUnit context ) { } }

Fix:
Module module = deploymentUnit . getAttachment ( MODULE ) ;