Thank you Chris. I'll check this possibility. On Wed, 2 Apr, 2025, 9:03 pm Christof, <c.schmalenb...@perfomatics.com> wrote:
> Hi Abhitosh, > groovy is one of the supported languages in jsr223 sampler. If your > javascript has not thousand codelines, I'm very optimistic, that with the > help of chatGPT you should be able to migrate your code > from js -> groovy. > regards > Christof > > > Am 2. April 2025 14:49:15 UTC schrieb Abhitosh Patil < > abhitosh...@gmail.com>: > >Initially I was using Java 17 but later switched to java 8 > >Currently getting error like "javax.script.scriptExecution: reference > >error: pm is not defined. > > > >Rhino or Graalvm are not available on our company download portal. > > > >I don't know anything about Groovy. > > > >On Wed, 2 Apr, 2025, 8:10 pm Dmitri T, <glin...@live.com> wrote: > > > >> 1. > >> You answered your own question: JavaScript code cannot be run in JMeter. > >> > >> > >> 1. > >> Also, if you're on Java 15+ you won't be able able to choose JavaScript > >> in JSR223 test elements because it has been removed from JDK< > >> https://openjdk.org/jeps/372> > >> 2. > >> There could be inconsistencies between Postman JavaScript API and JMeter > >> so you won't have access to pm. namespace in JMeter > >> > >> > >> So you either need to restore JavaScript engine by adding Mozilla Rhino< > >> https://github.com/mozilla/rhino> or switching to GraalVM< > >> https://www.graalvm.org/> or re-write your code in Groovy. The latter > >> option is better from performance perspective as Groovy scripts can be > >> compiled and cached and it matters especially for "heavy" tasks like > >> cryptography. More information: Apache Groovy: What Is Groovy Used For?< > >> https://www.blazemeter.com/blog/apache-groovy> > >> > >> > >> > >> ________________________________ > >> From: Abhitosh Patil <abhitosh...@gmail.com> > >> Sent: Wednesday, April 2, 2025 5:14 PM > >> To: JMeter Users List <user@jmeter.apache.org> > >> Subject: Need to execute javascript using JMeter > >> > >> We have a requirement to generate unique authentication signature to > pass > >> as a header in API request. We have a pre-request javascript for same in > >> postman tool. > >> > >> Same javascript we tried in JMeter using jsr223 and beanshell elements. > But > >> it's not working. Any solution for this? > >> >