Buggy code:
public class EmbeddedStandAloneServerFactory { public static final String JBOSS_EMBEDDED_ROOT = "jboss.embedded.root" ; private static class ModelControllerToModelControllerClientAdapter implements ModelControllerClient { private static class OperationResultAdapter implements Cancellable , OperationResult { private final OperationResult delegate ; OperationResultAdapter ( org . jboss . as . controller . OperationResult delegate ) { } @ Override public boolean cancel ( ) throws IOException { } @ Override public Cancellable getCancellable ( ) { } @ Override public ModelNode getCompensatingOperation ( ) { } } private static class ResultHandlerAdapter implements ResultHandler { private final org . jboss . as . controller . client . ResultHandler delegate ; ResultHandlerAdapter ( org . jboss . as . controller . client . ResultHandler delegate ) { } @ Override public void handleResultFragment ( String [ ] location , ModelNode result ) { } @ Override public void handleResultComplete ( ) { } @ Override public void handleFailed ( ModelNode failureDescription ) { } @ Override public void handleCancellation ( ) { } } private final ModelController delegate ; ModelControllerToModelControllerClientAdapter ( ModelController delegate ) { } @ Override public OperationResult execute ( ModelNode operation , org . jboss . as . controller . client . ResultHandler handler ) { } @ Override public ModelNode execute ( ModelNode operation ) throws IOException , CancellationException { } @ Override public OperationResult execute ( Operation operation , org . jboss . as . controller . client . ResultHandler handler ) { } @ Override public ModelNode execute ( Operation operation ) throws IOException , CancellationException { } @ Override public void close ( ) throws IOException { } } private EmbeddedStandAloneServerFactory ( ) { } public static StandaloneServer create ( final File jbossHomeDir , final ModuleLoader moduleLoader , final Properties systemProps , final Map < String , String > systemEnv ) { EmbeddedStandAloneServerFactory . setupCleanDirectories ( jbossHomeDir , systemProps ) ; StandaloneServer standaloneServer = new StandaloneServer ( ) { private ServiceContainer serviceContainer ; private ServerDeploymentManager serverDeploymentManager ; private Context context ; private ModelControllerClient modelControllerClient ; @ Override public void deploy ( File file ) throws IOException , InterruptedException , ExecutionException { execute ( serverDeploymentManager . newDeploymentPlan ( ) . add ( file . getName ( ) , VFSUtils . createJarFileInputStream ( VFS . getChild ( file . toURI ( ) ) ) ) . andDeploy ( ) . build ( ) ) ; } private ServerDeploymentPlanResult execute ( DeploymentPlan deploymentPlan ) throws InterruptedException , ExecutionException { return serverDeploymentManager . execute ( deploymentPlan ) . get ( ) ; } @ Override public Context getContext ( ) { return EmbeddedStandAloneServerFactory . ifSet ( context , "Server<seq2seq4repair_space>has<seq2seq4repair_space>not<seq2seq4repair_space>been<seq2seq4repair_space>started" ) ; } @ Override public ModelControllerClient getModelControllerClient ( ) { return modelControllerClient ; } @ Override public void start ( ) throws ServerStartException { try { <START_BUG> ServerEnvironment serverEnviromment = Main . determineEnvironment ( new String [ 0 ] , systemProps , systemEnv ) ; <END_BUG> Bootstrap bootstrap = Factory . newInstance ( ) ; Bootstrap . Configuration configuration = new Bootstrap . Configuration ( ) ; final QName rootElement = new QName ( CURRENT . getUriString ( ) , "server" ) ; final StandaloneXml parser = new StandaloneXml ( Module . getBootModuleLoader ( ) ) ; configuration . setConfigurationPersister ( new org . jboss . as . controller . persistence . TransientConfigurationPersister ( serverEnviromment . getServerConfigurationFile ( ) , rootElement , parser , parser ) ) ; configuration . setServerEnvironment ( serverEnviromment ) ; configuration . setModuleLoader ( moduleLoader ) ; Future < ServiceContainer > future = bootstrap . startup ( configuration , Collections . < ServiceActivator > emptyList ( ) ) ; serviceContainer = future . get ( ) ; final Value < ServerController > serverControllerService = ( ( Value < ServerController > ) ( serviceContainer . getRequiredService ( JBOSS_SERVER_CONTROLLER ) ) ) ; final ServerController controller = serverControllerService . getValue ( ) ; serverDeploymentManager = new org . jboss . as . server . deployment . client . ModelControllerServerDeploymentManager ( controller ) ; modelControllerClient = new EmbeddedStandAloneServerFactory . ModelControllerToModelControllerClientAdapter ( controller ) ; context = new InitialContext ( ) ; } catch ( RuntimeException rte ) { throw rte ; } catch ( Exception ex ) { throw new ServerStartException ( ex ) ; } } @ Override public void stop ( ) { if ( ( context ) != null ) { try { context . close ( ) ; context = null ; } catch ( NamingException e ) { e . printStackTrace ( ) ; } } serverDeploymentManager = null ; if ( ( serviceContainer ) != null ) { try { serviceContainer . shutdown ( ) ; serviceContainer . awaitTermination ( ) ; } catch ( RuntimeException rte ) { throw rte ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; } } } @ Override public void undeploy ( File file ) throws InterruptedException , ExecutionException { execute ( serverDeploymentManager . newDeploymentPlan ( ) . undeploy ( file . getName ( ) ) . andRemoveUndeployed ( ) . build ( ) ) ; } } ; return standaloneServer ; } private static < T > T ifSet ( T value , String message ) { } public static void setupCleanDirectories ( Properties props ) { } static void setupCleanDirectories ( File jbossHomeDir , Properties props ) { } private static File getFileUnderAsRoot ( File jbossHomeDir , Properties props , String propName , String relativeLocation , boolean mustExist ) { } private static File getTempRoot ( Properties props ) { } private static void validateDirectory ( String property , File file ) { } private static void copyDirectory ( File src , File dest ) { } }

Fix:
ServerEnvironment serverEnviromment = Main . determineEnvironment ( new String [ 0 ] , systemProps , systemEnv , EMBEDDED ) ;