Buggy code:
public class JndiViewOperation implements OperationStepHandler { public static final JndiViewOperation INSTANCE = new JndiViewOperation ( ) ; public static final String OPERATION_NAME = "jndi-view" ; public void execute ( final OperationContext context , final ModelNode operation ) throws OperationFailedException { final ModelNode resultNode = context . getResult ( ) ; <START_BUG> if ( ( context . getType ( ) ) == ( Type . SERVER ) ) { <END_BUG> context . addStep ( new OperationStepHandler ( ) { public void execute ( final OperationContext context , final ModelNode operation ) throws OperationFailedException { final ServiceRegistry serviceRegistry = context . getServiceRegistry ( false ) ; final ModelNode contextsNode = resultNode . get ( "java:<seq2seq4repair_space>contexts" ) ; final ServiceController < ? > javaContextService = serviceRegistry . getService ( JAVA_CONTEXT_SERVICE_NAME ) ; final NamingStore javaContextNamingStore = NamingStore . class . cast ( javaContextService . getValue ( ) ) ; try { addEntries ( contextsNode . get ( "java:" ) , new org . jboss . as . naming . NamingContext ( javaContextNamingStore , null ) ) ; } catch ( NamingException e ) { throw new OperationFailedException ( e , new ModelNode ( ) . set ( NamingMessages . MESSAGES . failedToReadContextEntries ( "java:" ) ) ) ; } final ServiceController < ? > jbossContextService = serviceRegistry . getService ( JBOSS_CONTEXT_SERVICE_NAME ) ; final NamingStore jbossContextNamingStore = NamingStore . class . cast ( jbossContextService . getValue ( ) ) ; try { addEntries ( contextsNode . get ( "java:jboss" ) , new org . jboss . as . naming . NamingContext ( jbossContextNamingStore , null ) ) ; } catch ( NamingException e ) { throw new OperationFailedException ( e , new ModelNode ( ) . set ( NamingMessages . MESSAGES . failedToReadContextEntries ( "java:jboss" ) ) ) ; } final ServiceController < ? > globalContextService = serviceRegistry . getService ( GLOBAL_CONTEXT_SERVICE_NAME ) ; final NamingStore globalContextNamingStore = NamingStore . class . cast ( globalContextService . getValue ( ) ) ; try { addEntries ( contextsNode . get ( "java:global" ) , new org . jboss . as . naming . NamingContext ( globalContextNamingStore , null ) ) ; } catch ( NamingException e ) { throw new OperationFailedException ( e , new ModelNode ( ) . set ( NamingMessages . MESSAGES . failedToReadContextEntries ( "java:global" ) ) ) ; } final ServiceController < ? > extensionRegistryController = serviceRegistry . getService ( SERVICE_NAME ) ; if ( extensionRegistryController != null ) { final JndiViewExtensionRegistry extensionRegistry = JndiViewExtensionRegistry . class . cast ( extensionRegistryController . getValue ( ) ) ; for ( JndiViewExtension extension : extensionRegistry . getExtensions ( ) ) { extension . execute ( new JndiViewExtensionContext ( ) { public OperationContext getOperationContext ( ) { return context ; } public ModelNode getResult ( ) { return resultNode ; } public void addEntries ( ModelNode current , Context context ) throws NamingException { JndiViewOperation . this . addEntries ( current , context ) ; } } ) ; } } context . completeStep ( ) ; } } , RUNTIME ) ; } else { throw new OperationFailedException ( new ModelNode ( ) . set ( NamingMessages . MESSAGES . jndiViewNotAvailable ( ) ) ) ; } context . completeStep ( ) ; } private void addEntries ( final ModelNode current , final Context context ) throws NamingException { } }

Fix:
if ( context . isNormalServer ( ) ) {