Search code examples
splitjmeterbeanshell

errors in JMeter log when using split method


how to avoid these erros in the log? The split method seem to work fine. it splits the string into 4 vars like it shoud.

i am using a BeanShell PostProcessor with the following script:

${__split(${VAR},VAR)}

${VAR} is something like bla.bla,123,12345,12345
VAR_n=4
VAR_1=bla.bla
VAR_2=123
VAR_3=12345
VAR_4=12345
VAR_5=null

http://jmeter.apache.org/usermanual/functions.html JMeter Log from GUI Mode:

  • 2017/01/19 18:36:14 ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval In file: inline evaluation of: ``longhaireddachshund.net,770,5007745,211092;'' Encountered "," at line 1, column 24.
  • 2017/01/19 18:36:14 WARN - jmeter.extractor.BeanShellPostProcessor: Problem in BeanShell script org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval In file: inline evaluation of: ``longhaireddachshund.net,770,5007745,211092;'' Encountered "," at line 1, column 24.

Solution

  • You need to pass the String literal or a variable containing the string to the split function.

    ${__split(${VAR},VAR)} will be replaced by ${__split(bla.bla,123,12345,12345,VAR)} - it makes it throw the error.

    Instead do like this as shown here.

    ${__split("${VAR}",VAR)} which will make it look like ${__split("bla.bla,123,12345,12345",VAR)} - you would not face any issues.