Bug 61486 - Make jmeter-server and non GUI mode run headless
Summary: Make jmeter-server and non GUI mode run headless
Status: RESOLVED FIXED
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.13
Hardware: All All
: P2 enhancement (vote)
Target Milestone: JMETER_5.1
Assignee: JMeter issues mailing list
URL:
Keywords: FixedInTrunk
: 63091 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-09-04 11:07 UTC by Duan, Yao
Modified: 2019-01-21 20:29 UTC (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Duan, Yao 2017-09-04 11:07:12 UTC
When I ran a JMeter test with JSR223 scripts on a Linux server without X (and Xlib), it failed:

2017-09-04 13:01:56,654 ERROR o.a.j.JMeter: Uncaught exception: 
java.lang.UnsatisfiedLinkError: /jdk/lib/libawt_xawt.so: Error loading shared library libXext.so.6: No such file or directory (needed by /jdk/lib/libawt_xawt.so)
	at java.lang.ClassLoader$NativeLibrary.load(Native Method) ~[?:?]
	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2614) ~[?:?]
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:2499) ~[?:?]
	at java.lang.Runtime.load0(Runtime.java:812) ~[?:?]
	at java.lang.System.load(System.java:1821) ~[?:?]
	at java.lang.ClassLoader$NativeLibrary.load(Native Method) ~[?:?]
	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2614) ~[?:?]
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:2520) ~[?:?]
	at java.lang.Runtime.loadLibrary0(Runtime.java:873) ~[?:?]
	at java.lang.System.loadLibrary(System.java:1857) ~[?:?]
	at java.awt.Toolkit$3.run(Toolkit.java:1358) ~[?:?]
	at java.awt.Toolkit$3.run(Toolkit.java:1356) ~[?:?]
	at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
	at java.awt.Toolkit.loadLibraries(Toolkit.java:1355) ~[?:?]
	at java.awt.Toolkit.<clinit>(Toolkit.java:1388) ~[?:?]
	at java.awt.Component.<clinit>(Component.java:590) ~[?:?]
	at org.apache.jmeter.testbeans.BeanInfoSupport.createPropertyGroup(BeanInfoSupport.java:255) ~[ApacheJMeter_core.jar:3.2 r1790748]
	at org.apache.jmeter.util.ScriptingBeanInfoSupport.<init>(ScriptingBeanInfoSupport.java:64) ~[ApacheJMeter_core.jar:3.2 r1790748]
	at org.apache.jmeter.util.JSR223BeanInfoSupport.<init>(JSR223BeanInfoSupport.java:87) ~[ApacheJMeter_core.jar:3.2 r1790748]
	at org.apache.jmeter.assertions.JSR223AssertionBeanInfo.<init>(JSR223AssertionBeanInfo.java:26) ~[ApacheJMeter_components.jar:3.2 r1790748]
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:?]
	at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:488) ~[?:?]
	at java.lang.Class.newInstance(Class.java:558) ~[?:?]
	at com.sun.beans.finder.InstanceFinder.instantiate(InstanceFinder.java:98) ~[?:?]
	at com.sun.beans.finder.InstanceFinder.find(InstanceFinder.java:66) ~[?:?]
	at java.beans.Introspector.findExplicitBeanInfo(Introspector.java:484) ~[?:?]
	at java.beans.Introspector.<init>(Introspector.java:434) ~[?:?]
	at java.beans.Introspector.getBeanInfo(Introspector.java:205) ~[?:?]
	at org.apache.jmeter.testbeans.TestBeanHelper.prepare(TestBeanHelper.java:66) ~[ApacheJMeter_core.jar:3.2 r1790748]
	at org.apache.jmeter.engine.StandardJMeterEngine.notifyTestListenersOfStart(StandardJMeterEngine.java:215) ~[ApacheJMeter_core.jar:3.2 r1790748]
	at org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:388) ~[ApacheJMeter_core.jar:3.2 r1790748]
	at java.lang.Thread.run(Thread.java:844) [?:?]

I think scripting should not depend on AWT and Xlib.
Comment 2 Duan, Yao 2017-09-06 13:42:56 UTC
libXext provides an X Window System client interface to several extensions to the X protocol. See https://packages.debian.org/stretch/libxext6
Comment 3 Philippe Mouawad 2017-09-07 20:02:21 UTC
Did you try running JMeter by adding this option :
-Djava.awt.headless=true

Thanks
Comment 4 Philippe Mouawad 2017-09-12 20:11:09 UTC
Hi team,
Any Linux user could validate this ?

Thanks
Comment 5 Milamber 2017-09-16 11:53:05 UTC
I don't have this issue on a Debian 9 without libxext packages. JMeter in non-gui mode works fine.

root@vm-test2:~/apache-jmeter-3.2/bin# java -version
java version "1.8.0_144"
[...]

root@vm-test2:~/apache-jmeter-3.2/bin# ./jmeter -n -t ./examples/PerformanceTestPlanMemoryThread.jmx 
Creating summariser <summary>
Created the tree successfully using ./examples/PerformanceTestPlanMemoryThread.jmx
Starting the test @ Sat Sep 16 12:50:43 WEST 2017 (1505562643751)
[...]


Can you indicate the Linux distro ? version ?
Java version too ?
Comment 6 Duan, Yao 2017-09-18 06:11:34 UTC
Hi Philippe Mouawad,
I just tried -Djava.awt.headless=true , and it did the trick. Thanks!
Maybe it's better to set java.awt.headless=true automatically when -n argument is passed to jmeter?

Hi Milamber,
My Linux distro is Alpine Linux 3.6.2 x86_64, and Java version is serverjre-9-ea+181, which can be downloaded from:

http://jdk.java.net/9/
http://download.java.net/java/jdk9-alpine/archive/181/binaries/serverjre-9-ea+181_linux-x64-musl_bin.tar.gz

I guess your Java package on Debian is "openjdk-xxx-headless"? It seems it run in headless mode automatically.
Comment 7 Milamber 2017-09-18 08:13:26 UTC
My Java version is :
$ java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

Directly downloaded from Oracle.com



Currently JMeter <=3.3 was not officially supported. Please use Java 8 from Oracle.


add headless=true when we use the -n option (or jmeter-server) seems a good idea, Philippe.
Comment 8 Philippe Mouawad 2017-09-20 11:57:56 UTC
(In reply to Milamber from comment #7)
> My Java version is :
> $ java -version
> java version "1.8.0_144"
> Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
> Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
> 
> Directly downloaded from Oracle.com
> 
> 
> 
> Currently JMeter <=3.3 was not officially supported. Please use Java 8 from
> Oracle.
> 
> 
> add headless=true when we use the -n option (or jmeter-server) seems a good
> idea, Philippe.

Yes feasible for jmeter-server but for jmeter with -n, it can only be in documentation.
Comment 9 Philippe Mouawad 2019-01-06 14:48:41 UTC
Author: pmouawad
Date: Sun Jan  6 14:47:32 2019
New Revision: 1850562

URL: http://svn.apache.org/viewvc?rev=1850562&view=rev
Log:
Bug 61486 - Make jmeter-server and non GUI mode run headless
Bugzilla Id: 61486

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/JMeter.java
    jmeter/trunk/src/core/org/apache/jmeter/NewDriver.java
    jmeter/trunk/xdocs/changes.xml
Comment 10 Philippe Mouawad 2019-01-06 14:49:47 UTC
Hello,
Anybody in the problematic configuration could test nightly build or last build after r1850562

Thanks
Regards
Comment 11 Philippe Mouawad 2019-01-06 18:39:44 UTC
Author: pmouawad
Date: Sun Jan  6 18:25:51 2019
New Revision: 1850583

URL: http://svn.apache.org/viewvc?rev=1850583&view=rev
Log:
Bug 61486 - Make jmeter-server and non GUI mode run headless
-g is non gui mode also
Bugzilla Id: 61486

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/NewDriver.java
Comment 12 Philippe Mouawad 2019-01-21 20:29:32 UTC
*** Bug 63091 has been marked as a duplicate of this bug. ***