Jmeter:"An error occurred: Can't connect to X11 window server using 'lacalhost:12.0' as the value of the display variable." 解决办法
做各种不同项目的性能测试,都需要在项目本地压测服务器配置jmeter,需要时还要调出jmeter图形化界面来调试jmeter脚本。
标题中的问题遇过多次,这次做个记录。
1. 启动jmeter报错
在配置好jmeter环境变量的linux系统执行jmeter命令,报错如下:
[root@localhost ~]# jmeter = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = Don't use GUI mode for load testing !, only for Test creation and Test debugging. For load testing, use CLI Mode (was NON GUI): jmeter -n -t [jmx file] -l [results file] -e -a [Path to web report falder] & increase Java Heap to meet your test requirements: Modify current env variable HEAP="-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m" in the jmeter batch file Check:https://jmeter.apache.org/usermanual/best-practices.html = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = An error occurred: Can't connect to X11 window server using 'lacalhost:12.0' as the value of the display variable.
2. 解决问题
2.1 设置DISPLAY变量
[root@localhost ~]# export DISPLAY=:0.0
2.2 安装xhost
[root@localhost ~]# yum -y install xhost
执行xhost+
[root@localhost ~]# xhost +
3. 启动jmeter
至此,问题解决。执行jmeter命令启动图形化界面。
[root@localhost ~]# jmeter = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = Don't use GUI mode for load testing !, only for Test creation and Test debugging. For load testing, use CLI Mode (was NON GUI): jmeter -n -t [jmx file] -l [results file] -e -o [Path to web report folder] & increase Java Heap to meet your test requirements: Modify current env variable HEAP="-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m" in the jmeter batch file Check :https://jmeter.apache.org/usermanual/best-practices.html = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = Jun 12, 2023 10:59:54 AM com.kitfox.svg.Text buildText WARNING: Could not create font Arial Jun 12, 2023 10:59:54 AM com.kitfox.svg.Text buildText WARNING: Could not create font Arial Jun 12, 2023 10:59:54 AM com.kitfox.svg.Text buildText WARNING: Could not create font Arial Jun 12, 2023 10:59:54 AM com.kitfox.svg.Text buildText WARNING: Could not create font Arial Jun 12, 2023 10:59:54 AM com.kitfox.svg.Text buildText WARNING: Could not create font Arial
类似问题。可参考:https://www.cnblogs.com/silgen/p/16668902.html
本文来自博客园,作者:查拉图斯特拉面条,转载请注明原文链接:https://www.cnblogs.com/n00dle/p/17475292.html