Buggy code:
bdmsByIdentifier . put ( module . getIdentifier ( ) , rootBeanDeploymentModule ) ; 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 ( ) ) ; 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 ( 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 BeanDeploymentArchiveImpl additional : deploymentUnit . getAttachmentList ( ADDITIONAL_BEAN_DEPLOYMENT_MODULES ) ) { beanDeploymentArchives . add ( additional ) ; additional . getServices ( ) . add ( EjbInjectionServices . class , ejbInjectionServices ) ; additional . getServices ( ) . add ( 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 ( ) ) ; installBootstrapConfigurationService ( deployment , parent ) ; weldBootstrapService . addWeldService ( EjbInjectionServices . class , ejbInjectionServices ) ; weldBootstrapService . addWeldService ( ResourceInjectionServices . class , resourceInjectionServices ) ; weldBootstrapService . addWeldService ( EjbServices . class , new org . jboss . as . weld . services . bootstrap . WeldEjbServices ( deploymentUnit . getServiceRegistry ( ) ) ) ; final JpaInjectionServices rootJpaInjectionServices = new org . jboss . as . weld . services . bootstrap . WeldJpaInjectionServices ( deploymentUnit ) ; 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 ) ; } <START_BUG> final WeldStartService weldStartService = new WeldStartService ( setupActions , module . getClassLoader ( ) ) ; <END_BUG> ServiceBuilder < WeldStartService > startService = serviceTarget . addService ( deploymentUnit . getServiceName ( ) . append ( WeldStartService . SERVICE_NAME ) , weldStartService ) . addDependency ( weldBootstrapServiceName , WeldBootstrapService . class , weldStartService . getBootstrap ( ) ) . addDependencies ( jpaServices ) ; startService . addDependency ( JndiNamingDependencyProcessor . serviceName ( deploymentUnit ) ) ; for ( DeploymentUnit sub : subDeployments ) { startService . addDependency ( JndiNamingDependencyProcessor . serviceName ( sub ) ) ; } startService . 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 ) { } private void installBootstrapConfigurationService ( WeldDeployment deployment , DeploymentUnit parentDeploymentUnit ) { } @ Override public void undeploy ( DeploymentUnit context ) { } }

Fix:
final WeldStartService weldStartService = new WeldStartService ( setupActions , module . getClassLoader ( ) , Utils . getRootDeploymentUnit ( deploymentUnit ) . getServiceName ( ) ) ;