[ https://issues.apache.org/jira/browse/STORM-745?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14481275#comment-14481275 ]
Jungtaek Lim commented on STORM-745: ------------------------------------ I modified storm.cmd for debug this behavior. {code} if %storm-command% == jar ( set STORM_OPTS=%STORM_CLIENT_OPTS% %STORM_OPTS% -Dstorm.jar=%2 set CLASSPATH=%CLASSPATH%;%2 set CLASS=%3 set args=%4 echo "-> %1 %2 %3 %4 %5 %6 %7 %8 %9" shift echo "-> %1 %2 %3 %4 %5 %6 %7 %8 %9" :start if [%4] == [] goto done set args=%args% %4 shift echo "--> %1 %2 %3 %4 %5 %6 %7 %8 %9" goto start :done echo %args% set storm-command-arguments=%args% ) echo "-->> %1 %2 %3 %4 %5 %6 %7 %8 %9" {code} When I execute "storm jar StormZeroMQ.jar com.wipro.bdas.zeromq.ZMQTopology value1 value2 value3 value4 value5", it prints below. "-> jar StormZeroMQ.jar com.wipro.bdas.zeromq.ZMQTopology value1 value2 value3 v alue4 value5 " "-> jar StormZeroMQ.jar com.wipro.bdas.zeromq.ZMQTopology value1 value2 value3 v alue4 value5 " "--> jar StormZeroMQ.jar com.wipro.bdas.zeromq.ZMQTopology value1 value2 value3 value4 value5 " "--> value1 value2 value3 value4 value5 " "--> value2 value3 value4 value5 " "--> value3 value4 value5 " value1 value3 value4 value5 "-->> value3 value4 value5 " As you see, shift doesn't evaluated before calling goto. I found the hint from http://ss64.com/nt/shift.html. {quote} The SHIFT command will not work within parenthesis/brackets, so place all your command line arguments in variables before running any FOR commands or other bracketed expressions. Or use the CALL syntax as explained in this forum thread. {quote} I'll post a pull request which fixes this behavior. > Second Commandline Parameter passed to the main class is skipped when run in > windows > ------------------------------------------------------------------------------------ > > Key: STORM-745 > URL: https://issues.apache.org/jira/browse/STORM-745 > Project: Apache Storm > Issue Type: Bug > Affects Versions: 0.9.3-rc2, 0.9.4 > Environment: Windows Only > Reporter: jishnu > Labels: 2nd, command-line, parameter, skipping, windows > > Always the second parameter is getting skipped. > E:\target>storm jar StormZeroMQ.jar com.wipro.bdas.zeromq.ZMQTopology value1 > value2 value3 value4 value5 > Output > I=0 value=value1 > I=1 value=value3 > I=2 value=value4 > I=3 value=value5 > public class ZMQTopology { > public static void main(String[] args) throws AlreadyAliveException, > InvalidTopologyException { > for(int i=0;i<(args.length);i++) > { System.out.println("I=" +i+ " > value="+args[i]); > } > I am using the apache storm pre-built for windows. > After some amount of debugging I could find that it happens only with windows > machine . I was able to reproduce the error in 2 windows machine. With both > 0.9.3 and 0.9.4 .In Linux machine I could see command line parameters working > perfectly. -- This message was sent by Atlassian JIRA (v6.3.4#6332)