Buggy code:
} moduleSpecByIdentifier . put ( module . getIdentifier ( ) , moduleSpecification ) ; beanDeploymentArchives . addAll ( rootBeanDeploymentModule . getBeanDeploymentArchives ( ) ) ; final List < DeploymentUnit > subDeployments = deploymentUnit . getAttachmentList ( SUB_DEPLOYMENTS ) ; final Set < ClassLoader > subDeploymentLoaders = new HashSet < ClassLoader > ( ) ; getJpaDependencies ( deploymentUnit , jpaServices ) ; for ( DeploymentUnit subDeployment : subDeployments ) { getJpaDependencies ( deploymentUnit , jpaServices ) ; final Module subDeploymentModule = subDeployment . getAttachment ( MODULE ) ; if ( subDeploymentModule == null ) { continue ; } subDeploymentLoaders . add ( subDeploymentModule . getClassLoader ( ) ) ; final ModuleSpecification subDeploymentModuleSpec = subDeployment . getAttachment ( MODULE_SPECIFICATION ) ; final BeanDeploymentModule bdm = subDeployment . getAttachment ( BEAN_DEPLOYMENT_MODULE ) ; if ( bdm == null ) { continue ; } beanDeploymentArchives . addAll ( bdm . getBeanDeploymentArchives ( ) ) ; List < BeanDeploymentModule > additionalModules = subDeployment . getAttachmentList ( VISIBLE_ADDITIONAL_BEAN_DEPLOYMENT_MODULE ) ; bdmsByIdentifier . put ( subDeploymentModule . getIdentifier ( ) , bdm ) ; moduleSpecByIdentifier . put ( subDeploymentModule . getIdentifier ( ) , subDeploymentModuleSpec ) ; final ResourceRoot subDeploymentRoot = subDeployment . getAttachment ( DEPLOYMENT_ROOT ) ; final EjbInjectionServices ejbInjectionServices = new org . jboss . as . weld . services . bootstrap . WeldEjbInjectionServices ( deploymentUnit . getServiceRegistry ( ) , eeModuleDescription , eeApplicationDescription , subDeploymentRoot . getRoot ( ) ) ; bdm . addService ( EjbInjectionServices . class , ejbInjectionServices ) ; final ResourceInjectionServices resourceInjectionServices = new org . jboss . as . weld . services . bootstrap . WeldResourceInjectionServices ( deploymentUnit . getServiceRegistry ( ) , eeModuleDescription ) ; bdm . addService ( ResourceInjectionServices . class , resourceInjectionServices ) ; for ( final BeanDeploymentModule additional : additionalModules ) { additional . addBeanDeploymentModule ( bdm ) ; bdm . addBeanDeploymentModule ( additional ) ; bdm . addService ( EjbInjectionServices . class , ejbInjectionServices ) ; bdm . addService ( ResourceInjectionServices . class , resourceInjectionServices ) ; } } for ( Map . Entry < ModuleIdentifier , BeanDeploymentModule > entry : bdmsByIdentifier . entrySet ( ) ) { final ModuleSpecification bdmSpec = moduleSpecByIdentifier . get ( entry . getKey ( ) ) ; final BeanDeploymentModule bdm = entry . getValue ( ) ; if ( bdm == rootBeanDeploymentModule ) { continue ; } for ( ModuleDependency dependency : bdmSpec . getSystemDependencies ( ) ) { BeanDeploymentModule other = bdmsByIdentifier . get ( dependency . getIdentifier ( ) ) ; if ( ( other != null ) && ( other != bdm ) ) { bdm . addBeanDeploymentModule ( other ) ; } } } final EjbInjectionServices ejbInjectionServices = new org . jboss . as . weld . services . bootstrap . WeldEjbInjectionServices ( deploymentUnit . getServiceRegistry ( ) , eeModuleDescription , eeApplicationDescription , deploymentRoot . getRoot ( ) ) ; final ResourceInjectionServices resourceInjectionServices = new org . jboss . as . weld . services . bootstrap . WeldResourceInjectionServices ( deploymentUnit . getServiceRegistry ( ) , eeModuleDescription ) ; rootBeanDeploymentModule . addService ( EjbInjectionServices . class , ejbInjectionServices ) ; rootBeanDeploymentModule . addService ( ResourceInjectionServices . class , resourceInjectionServices ) ; for ( final BeanDeploymentModule additional : deploymentUnit . getAttachmentList ( ADDITIONAL_BEAN_DEPLOYMENT_MODULES ) ) { beanDeploymentArchives . addAll ( additional . getBeanDeploymentArchives ( ) ) ; additional . addService ( EjbInjectionServices . class , ejbInjectionServices ) ; additional . addService ( ResourceInjectionServices . class , resourceInjectionServices ) ; } final Collection < Metadata < Extension > > extensions = WeldPortableExtensions . getPortableExtensions ( deploymentUnit ) . getExtensions ( ) ; final WeldDeployment deployment = new WeldDeployment ( beanDeploymentArchives , extensions , module , subDeploymentLoaders , deploymentUnit ) ; final WeldBootstrapService weldBootstrapService = new WeldBootstrapService ( deployment , Environments . EE_INJECT , deploymentUnit . getName ( ) ) ; weldBootstrapService . addWeldService ( EjbInjectionServices . class , ejbInjectionServices ) ; weldBootstrapService . addWeldService ( ResourceInjectionServices . class , resourceInjectionServices ) ; weldBootstrapService . addWeldService ( EjbServices . class , new org . jboss . as . weld . services . bootstrap . WeldEjbServices ( deploymentUnit . getServiceRegistry ( ) ) ) ; <START_BUG> final JpaInjectionServices rootJpaInjectionServices = new org . jboss . as . weld . services . bootstrap . WeldJpaInjectionServices ( deploymentUnit , deploymentUnit . getServiceRegistry ( ) ) ; <END_BUG> final JaxwsInjectionServices rootJaxWsInjectionServices = new org . jboss . as . weld . services . bootstrap . WeldJaxwsInjectionServices ( deploymentUnit ) ; weldBootstrapService . addWeldService ( JpaInjectionServices . class , rootJpaInjectionServices ) ; weldBootstrapService . addWeldService ( JaxwsInjectionServices . class , rootJaxWsInjectionServices ) ; final ServiceBuilder < WeldBootstrapService > weldBootstrapServiceBuilder = serviceTarget . addService ( weldBootstrapServiceName , weldBootstrapService ) ; weldBootstrapServiceBuilder . addDependencies ( TCCLSingletonService . SERVICE_NAME ) ; installSecurityService ( serviceTarget , deploymentUnit , weldBootstrapService , weldBootstrapServiceBuilder ) ; installTransactionService ( serviceTarget , deploymentUnit , weldBootstrapService , weldBootstrapServiceBuilder ) ; weldBootstrapServiceBuilder . install ( ) ; final List < SetupAction > setupActions = new ArrayList < SetupAction > ( ) ; JavaNamespaceSetup naming = deploymentUnit . getAttachment ( JAVA_NAMESPACE_SETUP_ACTION ) ; if ( naming != null ) { setupActions . add ( naming ) ; } final WeldStartService weldStartService = new WeldStartService ( setupActions , module . getClassLoader ( ) ) ; serviceTarget . addService ( deploymentUnit . getServiceName ( ) . append ( WeldStartService . SERVICE_NAME ) , weldStartService ) . addDependency ( weldBootstrapServiceName , WeldBootstrapService . class , weldStartService . getBootstrap ( ) ) . addDependency ( JndiNamingDependencyProcessor . serviceName ( deploymentUnit ) ) . addDependencies ( jpaServices ) . install ( ) ; } private void getJpaDependencies ( final DeploymentUnit deploymentUnit , final Set < ServiceName > jpaServices ) { } private ServiceName installSecurityService ( ServiceTarget serviceTarget , DeploymentUnit deploymentUnit , WeldBootstrapService weldService , ServiceBuilder < WeldBootstrapService > weldServiceBuilder ) { } private ServiceName installTransactionService ( final ServiceTarget serviceTarget , final DeploymentUnit deploymentUnit , WeldBootstrapService weldService , ServiceBuilder < WeldBootstrapService > weldServiceBuilder ) { } @ Override public void undeploy ( DeploymentUnit context ) { } }

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