title: JMeter BeanShell Property Setting Across Thread Group
body: <p>I'm trying to calculate the time between two events in JMeter using BeanShell PostProcessors. </p>
  
  <p>In the first block, I get the time and store it as a property. This is in one Thread Group.
  Then in another Thread Group, I have the second BeanShell block. I get an error which I cannot figure out. I have pasted the error here. Thank you very much for your hints and advice!</p>
  
  <p>Here are the two pieces of BeanShell code:</p>
  
  <p>FIRST POSTPROCESSOR:</p>
  
  <pre><code>//Set the current time to the time_upload variable
  long time_upload = prev.getTime(); // get POST Time
  
  props.put("time_upload",(String.valueof(time_upload))); 
  log.info("Time for Upload is: " + time_upload); // print difference to jmeter.log file
  </code></pre>
  
  <p>SECOND POSTPROCESSOR:</p>
  
  <pre><code>String no_saved_carts = vars.get("no_saved_carts");
  String no_saved_carts_trimmed = no_saved_carts.trim();
  
  String temp_description = vars.get("description");
  String temp_description_no_space = temp_description.trim();
  
  String time_upload_local = props.get("time_upload");
  
  
  if(temp_description_no_space.equals("&lt;/") || no_saved_carts_trimmed.equals("No Saved Carts Found")){
      vars.put("description","true");
  } else{
      vars.put("description","false");
      //set the time to time_processing based on time_upload
      long time_processing_done = prev.getTime(); // get time 
      long time_upload_long = Long.parseLong(time_upload_local); // get HTTP Sampler 1 execution time from variable
      long delta = (time_processing_done - time_upload); // calculate difference
      log.info("Time difference is: " + delta + " ms"); // print difference to jmeter.log file
  }
  </code></pre>
  
  <p>The relevant part of the ERROR LOG:</p>
  
  <pre><code>2016/06/03 17:21:22 ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval   Sourced file: inline evaluation of: ``//Set the current time to the time_upload variable long time_upload = prev.getTi . . . '' : Error in method invocation: Static method valueof( long ) not found in class'java.lang.String' 
  2016/06/03 17:21:22 WARN  - jmeter.extractor.BeanShellPostProcessor: Problem in BeanShell script org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval   Sourced file: inline evaluation of: ``//Set the current time to the time_upload variable long time_upload = prev.getTi . . . '' : Error in method invocation: Static method valueof( long ) not found in class'java.lang.String' 
  2016/06/03 17:21:22 INFO  - jmeter.threads.JMeterThread: Thread is done: Upload Saved Cart Thread Group 1-1 
  2016/06/03 17:21:22 INFO  - jmeter.threads.JMeterThread: Thread finished: Upload Saved Cart Thread Group 1-1 
  2016/06/03 17:21:22 ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval   Sourced file: inline evaluation of: ``String temp_description = vars.get("description"); String no_saved_carts = vars. . . . '' : Typed variable declaration : Method Invocation Long.parseLong 
  2016/06/03 17:21:22 WARN  - jmeter.extractor.BeanShellPostProcessor: Problem in BeanShell script org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval   Sourced file: inline evaluation of: ``String temp_description = vars.get("description"); String no_saved_carts = vars. . . . '' : Typed variable declaration : Method Invocation Long.parseLong 
  2016/06/03 17:21:26 INFO  - jmeter.threads.JMeterThread: Thread is done: Check Upload Status 2-1 
  </code></pre>