Buggy code:
final CreateDestroyService < Object > createDestroyService = new CreateDestroyService < Object > ( constructedValue ) ; final StartStopService < Object > startStopService = new StartStopService < Object > ( constructedValue ) ; final String serviceName = serviceConfig . getName ( ) ; final ServiceName createDestroyServiceName = convert ( serviceName ) . append ( ParsedServiceDeploymentProcessor . CREATE_SUFFIX ) ; final BatchServiceBuilder < ? > createDestroyServiceBuilder = batchBuilder . addService ( createDestroyServiceName , createDestroyService ) ; final ServiceName startStopServiceName = convert ( serviceName ) . append ( ParsedServiceDeploymentProcessor . START_SUFFIX ) ; final BatchServiceBuilder < ? > startStopServiceBuilder = batchBuilder . addService ( startStopServiceName , startStopService ) ; startStopServiceBuilder . addDependency ( createDestroyServiceName ) ; final JBossServiceDependencyConfig [ ] dependencyConfigs = serviceConfig . getDependencyConfigs ( ) ; if ( dependencyConfigs != null ) { for ( JBossServiceDependencyConfig dependencyConfig : dependencyConfigs ) { final ServiceName dependencyCreateDestroyServiceName = convert ( dependencyConfig . getDependencyName ( ) ) . append ( ParsedServiceDeploymentProcessor . CREATE_SUFFIX ) ; final ServiceName dependencyStartStopServiceName = convert ( dependencyConfig . getDependencyName ( ) ) . append ( ParsedServiceDeploymentProcessor . START_SUFFIX ) ; final String optionalAttributeName = dependencyConfig . getOptionalAttributeName ( ) ; if ( optionalAttributeName != null ) { createDestroyServiceBuilder . addDependency ( dependencyCreateDestroyServiceName , getPropertyInjector ( classValue , optionalAttributeName , createDestroyService , Values . injectedValue ( ) ) ) ; } else { createDestroyServiceBuilder . addDependency ( dependencyCreateDestroyServiceName ) ; } startStopServiceBuilder . addDependency ( dependencyStartStopServiceName ) ; } } final JBossServiceAttributeConfig [ ] attributeConfigs = serviceConfig . getAttributeConfigs ( ) ; if ( attributeConfigs != null ) { for ( JBossServiceAttributeConfig attributeConfig : attributeConfigs ) { final String attributeName = attributeConfig . getName ( ) ; final JBossServiceAttributeConfig . Inject inject = attributeConfig . getInject ( ) ; final JBossServiceAttributeConfig . ValueFactory valueFactory = attributeConfig . getValueFactory ( ) ; if ( inject != null ) { final String propertyName = inject . getPropertyName ( ) ; Value < ? > valueToInject = Values . injectedValue ( ) ; if ( propertyName != null ) { valueToInject = cached ( new org . jboss . msc . value . MethodValue < Object > ( new org . jboss . msc . value . LookupGetMethodValue ( classValue , propertyName ) , valueToInject , Values . < Object > emptyList ( ) ) ) ; } createDestroyServiceBuilder . addDependency ( convert ( inject . getBeanName ( ) ) . append ( ParsedServiceDeploymentProcessor . CREATE_SUFFIX ) , getPropertyInjector ( classValue , attributeName , createDestroyService , valueToInject ) ) ; startStopServiceBuilder . addDependencies ( convert ( inject . getBeanName ( ) ) . append ( ParsedServiceDeploymentProcessor . START_SUFFIX ) ) ; } else if ( valueFactory != null ) { final String methodName = valueFactory . getMethodName ( ) ; final JBossServiceAttributeConfig [ ] parameters = valueFactory . getParameters ( ) ; final List < Value < Class < ? > > > paramTypes = new ArrayList < Value < Class < ? > > > ( parameters . length ) ; final List < Value < ? > > paramValues = new ArrayList < Value < ? > > ( parameters . length ) ; for ( JBossServiceAttributeConfig . ValueFactoryParameter parameter : parameters ) { final Value < Class < ? > > attributeTypeValue = cached ( new org . jboss . msc . value . LookupClassValue ( parameter . getType ( ) , classLoaderValue ) ) ; paramTypes . add ( attributeTypeValue ) ; paramValues . add ( cached ( new ParsedServiceDeploymentProcessor . ArgumentValue ( attributeTypeValue , parameter . getValue ( ) ) ) ) ; } final Value < ? > valueToInject = cached ( new org . jboss . msc . value . MethodValue ( new org . jboss . msc . value . LookupMethodValue ( classValue , methodName , paramTypes ) , Values . injectedValue ( ) , paramValues ) ) ; createDestroyServiceBuilder . addDependency ( convert ( valueFactory . getBeanName ( ) ) . append ( ParsedServiceDeploymentProcessor . CREATE_SUFFIX ) , getPropertyInjector ( classValue , attributeName , createDestroyService , valueToInject ) ) ; startStopServiceBuilder . addDependencies ( convert ( valueFactory . getBeanName ( ) ) . append ( ParsedServiceDeploymentProcessor . START_SUFFIX ) ) ; } else { createDestroyServiceBuilder . addInjectionValue ( getPropertyInjector ( classValue , attributeName , createDestroyService , Values . injectedValue ( ) ) , cached ( new ParsedServiceDeploymentProcessor . AttributeValue ( classValue , attributeName , attributeConfig . getValue ( ) ) ) ) ; } } } final MBeanRegistrationService < Object > mbeanRegistrationService = new MBeanRegistrationService ( serviceName ) ; <START_BUG> batchBuilder . addService ( SERVICE_NAME . append ( serviceName ) , mbeanRegistrationService ) . addDependency ( MBEAN_SERVER_SERVICE_NAME , MBeanServer . class , mbeanRegistrationService . getMBeanServerInjector ( ) ) . addDependency ( startStopServiceName , Object . class , mbeanRegistrationService . getValueInjector ( ) ) ; <END_BUG> } private Injector < Object > getPropertyInjector ( final Value < Class < ? > > classValue , final String propertyName , final CreateDestroyService < ? > startStopService , final Value < ? > value ) { } private ServiceName convert ( final String name ) { } private < T > Value < T > cached ( final Value < T > value ) { } private static class AttributeValue < T > implements Value < T > { private final Value < Class < ? > > targetClassValue ; private final String name ; private final String value ; private AttributeValue ( Value < Class < ? > > targetClassValue , String name , String value ) { } @ Override public T getValue ( ) throws IllegalStateException { } } private static class ArgumentValue < T > implements Value < T > { private final Value < Class < ? > > typeValue ; private final String value ; private ArgumentValue ( final Value < Class < ? > > typeValue , final String value ) { } @ Override public T getValue ( ) throws IllegalStateException { } } }

Fix:
batchBuilder . addService ( SERVICE_NAME . append ( serviceName ) , mbeanRegistrationService ) . addDependency ( MBeanServerService . SERVICE_NAME , MBeanServer . class , mbeanRegistrationService . getMBeanServerInjector ( ) ) . addDependency ( startStopServiceName , Object . class , mbeanRegistrationService . getValueInjector ( ) ) ;