3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

JMeter起動に失敗する対策

Last updated at Posted at 2023-12-03

MacでJMeterインストールしても、

% brew install jmeter

起動させようとすると、起動中にJMeterのロゴが表示されるものの強制終了となってしまい、
jmeter WARNING: package sun.awt.X11 not in java.desktopなどとなり起動しない対策

% jmeter
WARNING: package sun.awt.X11 not in java.desktop
WARN StatusConsoleListener The use of package scanning to locate plugins is deprecated and will be removed in a future release
WARN StatusConsoleListener The use of package scanning to locate plugins is deprecated and will be removed in a future release
WARN StatusConsoleListener The use of package scanning to locate plugins is deprecated and will be removed in a future release
WARN StatusConsoleListener The use of package scanning to locate plugins is deprecated and will be removed in a future release
================================================================================
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
================================================================================
/opt/homebrew/Cellar/jmeter/5.6.2/libexec/bin/jmeter: line 199: 20026 Trace/BPT trap: 5       "$JAVA_HOME/bin/java" $ARGS $JVM_ARGS $JMETER_OPTS -jar "$PRGDIR/ApacheJMeter.jar" "$@"

JavaをAdoptOpenJDKに変える。

% brew install AdoptOpenJDK

インストールされているJavaを確認

/usr/libexec/java_home -V
Matching Java Virtual Machines (2):
    17.0.1 (arm64) "Oracle Corporation" - "Java SE 17.0.1" /Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home
    16.0.1 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 16" /Library/Java/JavaVirtualMachines/adoptopenjdk-16.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home

Oracle の Java と AdoptOpenJDK の2種類がインストールされている。

パスを変える

.zshrc の末尾に下記を追加

.zshrc
export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-16.jdk/Contents/Home
PATH=$JAVA_HOME/bin:$PATH

.zshrcの変更を反映

% source .zshrc

JMeterの起動コマンドを修正します。
起動コマンドのJAVA_HOME部分を削除します。

修正前

/opt/homebrew/Cellar/jmeter/5.6.2/bin/jmeter
#!/bin/bash
JAVA_HOME="/opt/homebrew/opt/openjdk@17" exec "/opt/homebrew/Cellar/jmeter/5.6.2/libexec/bin/jmeter"  "$@"

修正後

/opt/homebrew/Cellar/jmeter/5.6.2/bin/jmeter
#!/bin/bash
exec "/opt/homebrew/Cellar/jmeter/5.6.2/libexec/bin/jmeter"  "$@"

これでjmeter起動できました。

% jmeter
WARNING: package sun.awt.X11 not in java.desktop
WARN StatusConsoleListener The use of package scanning to locate plugins is deprecated and will be removed in a future release
WARN StatusConsoleListener The use of package scanning to locate plugins is deprecated and will be removed in a future release
WARN StatusConsoleListener The use of package scanning to locate plugins is deprecated and will be removed in a future release
WARN StatusConsoleListener The use of package scanning to locate plugins is deprecated and will be removed in a future release
================================================================================
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
================================================================================
Warning: the fonts "Times" and "Times" are not available for the Java logical font "Serif", which may have unexpected appearance or behavior. Re-enable the "Times" font to remove this warning.

原因ですが、OracleのJavaではJMeterはJava8までしか対応していなく、AdoptOpenJDKはJava8以降にも対応していますが、jmeter起動コマンドがJAVA_HOMEを固定していたためにAdoptOpenJDKをインストールするだけではJMeterのJavaは切り替わらず、OracleのJavaで起動し続けていたためのように見えます。
WARNING: package sun.awt.X11 not in java.desktop は出たままですが、JMeter起動できたため良しとします。

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?