0
votes

I have a BeanShell Postprocessor in the setUpThread Group to capture the cookies and Beanshell preprocessor in the main thread (as a first step) to use the cookies captured in the previous setUpThread like: enter image description here

I am getting the below error IF I add the 2 lines sampler from JSR223 or Beanshell sampler although CFLAG was declared in the UDV section of the Payment thread: enter image description here

ERROR o.a.j.u.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: import org.apache.jmeter.protocol.http.control.CookieManager; import org.apache. . . . '' : Typed variable declaration : Error in method invocation: Method getCookieManager() not found in class'org.apache.jmeter.protocol.java.sampler.JSR223Sampler' 2020-06-05 15:37:44,168 WARN o.a.j.m.BeanShellPreProcessor: Problem in BeanShell script. org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of:import org.apache.jmeter.protocol.http.control.CookieManager; import org.apache. . . . '' : Typed variable declaration : Error in method invocation: Method getCookieManager() not found in class'org.apache.jmeter.protocol.java.sampler.JSR223Sampler'

1
This error is appearing for any subsequent samplers which are like JSR223/BSH/.. but it does not stop the script (meaning it is not a show-stopper)nkpalani

1 Answers

0
votes

The location of your Beanshell PreProcessor (and PostProcessor) violates JMeter Scoping Rules, the error you're getting is due to:

  • According to the scope of the Pre and PostProcessors they are being applied to all samplers in the given Thread Group
  • One of the Samplers is JSR223 Sampler which doesn't have an instance of the HTTP Cookie Manager (only HTTP Request sampler does)

So the solution would be placing the Pre/Post processors as the children of the HTTP Request sampler and this error will go away.

Also be aware that starting from JMeter 3.1 you should be using JSR223 Test Elements and Groovy language for scripting so consider getting rid of these Beanshell test elements