Bug? JMeter is not using the default groovy

Previous Topic Next Topic
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

Bug? JMeter is not using the default groovy

Tong Sun

I've already set the default groovy version, but it seems that JMeter
insists something of its own:

$ groovy --version
Groovy Version: 2.4.12 JVM: 1.8.0_261 Vendor: Oracle Corporation OS: Mac OS X

$ jmeter -f -n -t $jmxf.jmx
Creating summariser <summary>
CStarting standalone test @ Tue Feb 02 17:01:38 EST 2021 (1612303298756)
Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message
on port 4445
Uncaught Exception java.lang.ExceptionInInitializerError in thread
Thread[StandardJMeterEngine,5,main]. See log file for details.

$ grep -A18 'Uncaught ' jmeter.log
2021-02-02 17:01:39,132 ERROR o.a.j.JMeter: Uncaught exception in
thread Thread[StandardJMeterEngine,5,main]
java.lang.ExceptionInInitializerError: null
        at org.codehaus.groovy.jsr223.GroovyScriptEngineFactory.getLanguageVersion(GroovyScriptEngineFactory.java:95)
        at org.apache.jmeter.util.JSR223BeanInfoSupport.<clinit>(JSR223BeanInfoSupport.java:70)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method) ~[?:1.8.0_261]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_261]
        at com.sun.beans.finder.InstanceFinder.instantiate(InstanceFinder.java:96)
        at com.sun.beans.finder.InstanceFinder.find(InstanceFinder.java:66)
        at java.beans.Introspector.findExplicitBeanInfo(Introspector.java:448)
        at java.beans.Introspector.<init>(Introspector.java:398) ~[?:1.8.0_261]
        at java.beans.Introspector.getBeanInfo(Introspector.java:173)
        at org.apache.jmeter.testbeans.TestBeanHelper.prepare(TestBeanHelper.java:67)
        at org.apache.jmeter.engine.StandardJMeterEngine.notifyTestListenersOfStart(StandardJMeterEngine.java:202)
        at org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:380)
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_261]
Caused by: groovy.lang.GroovyRuntimeException: Conflicting module
versions. Module [groovy-xml is loaded in version 3.0.3 and you are
trying to load version 2.4.12


So how to tell my JMeter not to use groovy v3.0.3 but v2.4.12?

Note this only happens when running JMeter in -n(NON_GUI) mode. GUI
mode is somehow fine.


To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view

Re: Bug? JMeter is not using the default groovy

For sure it's not a JMeter bug, it's an example of  Jar Hell
<https://dzone.com/articles/what-is-jar-hell>   where you have multiple
versions of the same library in the  CLASSPATH

There are groovy-*.jar libraries in JMeter Classpath
<https://jmeter.apache.org/usermanual/get-started.html#classpath>   (lib
folder of your JMeter installation) and JMeter automatically loads them on
start and if you're adding more Groovy libraries to the classpath by any
means it results in 2 same libraries of different versions with undefined
order when it comes to classloading.

If you want to use your own Groovy - remove JMeter's version and vice versa.

Just in case if you cannot remove JMeter's libraries, the latest version of
JMeter which was shipped with Groovy 2.4.12 was  JMeter 3.3

Also  according to JMeter Best Practices you should always be using the
latest version of JMeter
<https://jmeter.apache.org/usermanual/best-practices.html>   which is
JMeter 5.4.1
as of now and it comes with Groovy 3.0.7 so switching to JMeter's groovy or
upgrading your installed SDK might be a viable solution.

Sent from: http://www.jmeter-archive.org/JMeter-User-f512775.html

To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]