Buggy code:
public class ExternalBeanArchiveProcessor implements DeploymentUnitProcessor { private static final String META_INF_BEANS_XML = "META-INF//beans.xml" ; @ Override public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; if ( ! ( WeldDeploymentMarker . isPartOfWeldDeployment ( deploymentUnit ) ) ) { return ; } if ( ( deploymentUnit . getParent ( ) ) != null ) { return ; } final Set < String > componentClassNames = new HashSet < > ( ) ; final String beanArchiveIdPrefix = ( deploymentUnit . getName ( ) ) + ".external." ; final List < DeploymentUnit > deploymentUnits = new ArrayList < DeploymentUnit > ( ) ; deploymentUnits . add ( deploymentUnit ) ; deploymentUnits . addAll ( deploymentUnit . getAttachmentList ( SUB_DEPLOYMENTS ) ) ; PropertyReplacingBeansXmlParser parser = new PropertyReplacingBeansXmlParser ( deploymentUnit ) ; final Map < URL , List < DeploymentUnit > > deploymentUnitMap = new HashMap < URL , List < DeploymentUnit > > ( ) ; final HashSet < URL > existing = new HashSet < URL > ( ) ; for ( DeploymentUnit deployment : deploymentUnits ) { try { final WeldDeploymentMetadata weldDeploymentMetadata = deployment . getAttachment ( ATTACHMENT_KEY ) ; if ( weldDeploymentMetadata != null ) { for ( BeanArchiveMetadata md : weldDeploymentMetadata . getBeanArchiveMetadata ( ) ) { existing . add ( md . getBeansXmlFile ( ) . toURL ( ) ) ; if ( ( md . getAdditionalBeansXmlFile ( ) ) != null ) { existing . add ( md . getAdditionalBeansXmlFile ( ) . toURL ( ) ) ; } } } } catch ( MalformedURLException e ) { throw new DeploymentUnitProcessingException ( e ) ; } EEModuleDescription moduleDesc = deployment . getAttachment ( EE_MODULE_DESCRIPTION ) ; if ( moduleDesc != null ) { for ( ComponentDescription component : moduleDesc . getComponentDescriptions ( ) ) { componentClassNames . add ( component . getComponentClassName ( ) ) ; } } } for ( DeploymentUnit deployment : deploymentUnits ) { final Module module = deployment . getAttachment ( MODULE ) ; if ( module == null ) { return ; } try { Enumeration < URL > resources = module . getClassLoader ( ) . getResources ( ExternalBeanArchiveProcessor . META_INF_BEANS_XML ) ; while ( resources . hasMoreElements ( ) ) { final URL beansXml = resources . nextElement ( ) ; if ( existing . contains ( beansXml ) ) { continue ; } if ( beansXml . toString ( ) . contains ( "jsf-impl-2.2" ) ) { continue ; } DEPLOYMENT_LOGGER . debugf ( "Found<seq2seq4repair_space>external<seq2seq4repair_space>beans.xml:<seq2seq4repair_space>%s" , beansXml . toString ( ) ) ; List < DeploymentUnit > dus = deploymentUnitMap . get ( beansXml ) ; if ( dus == null ) { deploymentUnitMap . put ( beansXml , ( dus = new ArrayList < DeploymentUnit > ( ) ) ) ; } dus . add ( deployment ) ; } } catch ( IOException e ) { throw new DeploymentUnitProcessingException ( e ) ; } } for ( final Map . Entry < URL , List < DeploymentUnit > > entry : deploymentUnitMap . entrySet ( ) ) { final Module module = entry . getValue ( ) . get ( 0 ) . getAttachment ( MODULE ) ; final BeansXml beansXml = parseBeansXml ( entry . getKey ( ) , parser , deploymentUnit ) ; final UrlScanner urlScanner = new UrlScanner ( ) ; final List < String > discoveredClasses = new ArrayList < String > ( ) ; if ( ! ( urlScanner . handleBeansXml ( entry . getKey ( ) , discoveredClasses ) ) ) { continue ; } discoveredClasses . removeAll ( componentClassNames ) ; final BeanDeploymentArchiveImpl bda = new BeanDeploymentArchiveImpl ( new HashSet < String > ( discoveredClasses ) , beansXml , module , ( beanArchiveIdPrefix + ( entry . getKey ( ) . toExternalForm ( ) ) ) ) ; final BeanDeploymentModule bdm = new BeanDeploymentModule ( Collections . singleton ( bda ) ) ; <START_BUG> final JpaInjectionServices jpaInjectionServices = new org . jboss . as . weld . services . bootstrap . WeldJpaInjectionServices ( deploymentUnit , deploymentUnit . getServiceRegistry ( ) ) ; <END_BUG> final JaxwsInjectionServices jaxwsInjectionServices = new org . jboss . as . weld . services . bootstrap . WeldJaxwsInjectionServices ( deploymentUnit ) ; bdm . addService ( JpaInjectionServices . class , jpaInjectionServices ) ; bdm . addService ( JaxwsInjectionServices . class , jaxwsInjectionServices ) ; deploymentUnit . addToAttachmentList ( ADDITIONAL_BEAN_DEPLOYMENT_MODULES , bdm ) ; for ( DeploymentUnit du : entry . getValue ( ) ) { du . addToAttachmentList ( VISIBLE_ADDITIONAL_BEAN_DEPLOYMENT_MODULE , bdm ) ; } } } @ Override public void undeploy ( DeploymentUnit context ) { } private BeansXml parseBeansXml ( URL beansXmlFile , BeansXmlParser parser , final DeploymentUnit deploymentUnit ) throws DeploymentUnitProcessingException { } }

Fix:
final JpaInjectionServices jpaInjectionServices = new org . jboss . as . weld . services . bootstrap . WeldJpaInjectionServices ( deploymentUnit ) ;