Buggy code:
StormOnYarn . LOG . debug ( ( "_appId:" + ( _appId ) ) ) ; if ( amMB > ( app . getMaximumResourceCapability ( ) . getMemory ( ) ) ) { amMB = app . getMaximumResourceCapability ( ) . getMemory ( ) ; } ApplicationSubmissionContext appContext = Records . newRecord ( ApplicationSubmissionContext . class ) ; appContext . setApplicationId ( app . getApplicationId ( ) ) ; appContext . setApplicationName ( appName ) ; appContext . setQueue ( queue ) ; ContainerLaunchContext amContainer = Records . newRecord ( ContainerLaunchContext . class ) ; Map < String , LocalResource > localResources = new HashMap < String , LocalResource > ( ) ; StormOnYarn . LOG . info ( "Copy<seq2seq4repair_space>App<seq2seq4repair_space>Master<seq2seq4repair_space>jar<seq2seq4repair_space>from<seq2seq4repair_space>local<seq2seq4repair_space>filesystem<seq2seq4repair_space>and<seq2seq4repair_space>add<seq2seq4repair_space>to<seq2seq4repair_space>local<seq2seq4repair_space>environment" ) ; String appMasterJar = StormOnYarn . findContainingJar ( MasterServer . class ) ; FileSystem fs = FileSystem . get ( _hadoopConf ) ; Path src = new Path ( appMasterJar ) ; String appHome = Util . getApplicationHomeForId ( _appId . toString ( ) ) ; Path dst = new Path ( fs . getHomeDirectory ( ) , ( ( appHome + ( Path . SEPARATOR ) ) + "AppMaster.jar" ) ) ; fs . copyFromLocalFile ( false , true , src , dst ) ; localResources . put ( "AppMaster.jar" , Util . newYarnAppResource ( fs , dst ) ) ; String stormVersion = Util . getStormVersion ( _stormConf ) ; Path zip ; if ( storm_zip_location != null ) { zip = new Path ( storm_zip_location ) ; } else { zip = new Path ( ( ( "//lib//storm//" + stormVersion ) + "//storm.zip" ) ) ; } _stormConf . put ( "storm.zip.path" , zip . makeQualified ( fs ) . toUri ( ) . getPath ( ) ) ; LocalResourceVisibility visibility = LocalResourceVisibility . PUBLIC ; _stormConf . put ( "storm.zip.visibility" , "PUBLIC" ) ; if ( ! ( Util . isPublic ( fs , zip ) ) ) { visibility = LocalResourceVisibility . APPLICATION ; _stormConf . put ( "storm.zip.visibility" , "APPLICATION" ) ; } localResources . put ( "storm" , Util . newYarnAppResource ( fs , zip , ARCHIVE , visibility ) ) ; Path dirDst = Util . createConfigurationFileInFs ( fs , appHome , _stormConf , _hadoopConf ) ; localResources . put ( "conf" , Util . newYarnAppResource ( fs , dirDst ) ) ; amContainer . setLocalResources ( localResources ) ; StormOnYarn . LOG . info ( "Set<seq2seq4repair_space>the<seq2seq4repair_space>environment<seq2seq4repair_space>for<seq2seq4repair_space>the<seq2seq4repair_space>application<seq2seq4repair_space>master" ) ; Map < String , String > env = new HashMap < String , String > ( ) ; Apps . addToEnvironment ( env , CLASSPATH . name ( ) , ".//conf" ) ; Apps . addToEnvironment ( env , CLASSPATH . name ( ) , ".//AppMaster.jar" ) ; for ( String c : _hadoopConf . getStrings ( YARN_APPLICATION_CLASSPATH , DEFAULT_YARN_APPLICATION_CLASSPATH ) ) { Apps . addToEnvironment ( env , CLASSPATH . name ( ) , c . trim ( ) ) ; } List < String > yarn_classpath_cmd = Arrays . asList ( "yarn" , "classpath" ) ; ProcessBuilder pb = new ProcessBuilder ( yarn_classpath_cmd ) ; pb . environment ( ) . putAll ( System . getenv ( ) ) ; Process proc = pb . start ( ) ; Util . redirectStreamAsync ( proc . getErrorStream ( ) , System . err ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( proc . getInputStream ( ) , "UTF-8" ) ) ; String line = "" ; StringBuilder yarn_class_path = new StringBuilder ( ) ; while ( ( line = reader . readLine ( ) ) != null ) yarn_class_path . append ( line ) ; proc . waitFor ( ) ; reader . close ( ) ; Apps . addToEnvironment ( env , CLASSPATH . name ( ) , yarn_class_path . toString ( ) ) ; String stormHomeInZip = Util . getStormHomeInZip ( fs , zip , stormVersion ) ; StormOnYarn . LOG . info ( ( "Storm<seq2seq4repair_space>home<seq2seq4repair_space>is:<seq2seq4repair_space>" + stormHomeInZip ) ) ; Apps . addToEnvironment ( env , CLASSPATH . name ( ) , ( ( ".//storm//" + stormHomeInZip ) + "//*" ) ) ; Apps . addToEnvironment ( env , CLASSPATH . name ( ) , ( ( ".//storm//" + stormHomeInZip ) + "//lib//*" ) ) ; env . put ( "appJar" , appMasterJar ) ; env . put ( "appName" , appName ) ; env . put ( "appId" , new Integer ( _appId . getId ( ) ) . toString ( ) ) ; amContainer . setEnvironment ( env ) ; Vector < String > vargs = new Vector < String > ( ) ; <START_BUG> vargs . add ( "$JAVA_HOME//bin//java" ) ; <END_BUG> vargs . add ( ( ( "-Dstorm.home=.//storm//" + stormHomeInZip ) + "//" ) ) ; vargs . add ( "com.yahoo.storm.yarn.MasterServer" ) ; vargs . add ( ( ( "1>" + ( ApplicationConstants . LOG_DIR_EXPANSION_VAR ) ) + "//stdout" ) ) ; vargs . add ( ( ( "2>" + ( ApplicationConstants . LOG_DIR_EXPANSION_VAR ) ) + "//stderr" ) ) ; StormOnYarn . LOG . info ( ( "Classpath:<seq2seq4repair_space>" + ( env . get ( CLASSPATH . name ( ) ) ) ) ) ; StormOnYarn . LOG . info ( ( "Setting<seq2seq4repair_space>up<seq2seq4repair_space>app<seq2seq4repair_space>master<seq2seq4repair_space>command:" + vargs ) ) ; amContainer . setCommands ( vargs ) ; Resource capability = Records . newRecord ( Resource . class ) ; capability . setMemory ( amMB ) ; amContainer . setResource ( capability ) ; appContext . setAMContainerSpec ( amContainer ) ; _yarn . submitApplication ( appContext ) ; } public boolean waitUntilLaunched ( ) throws YarnRemoteException { } public static String findContainingJar ( Class < ? > my_class ) throws IOException { } public static StormOnYarn launchApplication ( String appName , String queue , int amMB , @ SuppressWarnings ( "rawtypes" ) Map stormConf , String storm_zip_location ) throws Exception { } public static StormOnYarn attachToApp ( String appId , @ SuppressWarnings ( "rawtypes" ) Map stormConf ) { } }

Fix:
vargs . add ( "java" ) ;