Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JMeter cannot be run in macOS Sonoma (Apple Silicon) by Homebrew #6083

Closed
zzxrain opened this issue Oct 6, 2023 · 35 comments
Closed

JMeter cannot be run in macOS Sonoma (Apple Silicon) by Homebrew #6083

zzxrain opened this issue Oct 6, 2023 · 35 comments

Comments

@zzxrain
Copy link

zzxrain commented Oct 6, 2023

Expected behavior

Run jmeter successfully

Actual behavior

JMeter crashed after display startup logo

Screenshot 2023-10-06 at 15 29 48

Below are defailed report.
crash_report.log

Steps to reproduce the problem

  1. Install jmeter by homebrew (automatically install openJDK)
brew install jmeter
  1. run jmeter in terminal/iTerm2
jmeter
  1. I re-tested it by Amazon-Corretto-11 & 21, it is the same result.

It looks like no useful info in jmeter.log
jmeter.log

JMeter Version

5.6.2

Java Version

11.0.20.1

OS Version

macOS Sonoma Version 14.0 (23A344)

@vlsi
Copy link
Collaborator

vlsi commented Oct 6, 2023

@weisJ , do you think it might be Darklaf-related?

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BREAKPOINT (SIGTRAP)
Exception Codes:       0x0000000000000001, 0x000000018749161c

Termination Reason:    Namespace SIGNAL, Code 5 Trace/BPT trap: 5
Terminating Process:   exc handler [6785]

Application Specific Information:
References to Carbon menus are disallowed with AppKit menu system (see rdar://101002625). Use instances of NSMenu and NSMenuItem directly instead.

@zzxrain , do you think you could try running without darklaf?
For instance:
Download sources, replace LAF as follows:

--- a/src/core/src/main/java/org/apache/jmeter/gui/action/LookAndFeelCommand.java
+++ b/src/core/src/main/java/org/apache/jmeter/gui/action/LookAndFeelCommand.java
@@ -172,7 +172,7 @@ public class LookAndFeelCommand extends AbstractAction {
      * @return command that would activate the preferred LaF
      */
     public static String getPreferredLafCommand() {
-        String laf = PREFS.get(USER_PREFS_KEY, null);
+        String laf = "laf:com.apple.laf.AquaLookAndFeel";
         if (laf != null) {
             return laf;
         }

Start JMeter with ./gradlew runGui

Will it launch?

@weisJ
Copy link
Contributor

weisJ commented Oct 6, 2023

I’ll have a look. However the native menu bar used in darklaf is simply the one provided by the jdk, so I’m not sure how much I can do about it.

@zzxrain
Copy link
Author

zzxrain commented Oct 7, 2023

@weisJ , do you think it might be Darklaf-related?

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BREAKPOINT (SIGTRAP)
Exception Codes:       0x0000000000000001, 0x000000018749161c

Termination Reason:    Namespace SIGNAL, Code 5 Trace/BPT trap: 5
Terminating Process:   exc handler [6785]

Application Specific Information:
References to Carbon menus are disallowed with AppKit menu system (see rdar://101002625). Use instances of NSMenu and NSMenuItem directly instead.

@zzxrain , do you think you could try running without darklaf? For instance: Download sources, replace LAF as follows:

--- a/src/core/src/main/java/org/apache/jmeter/gui/action/LookAndFeelCommand.java
+++ b/src/core/src/main/java/org/apache/jmeter/gui/action/LookAndFeelCommand.java
@@ -172,7 +172,7 @@ public class LookAndFeelCommand extends AbstractAction {
      * @return command that would activate the preferred LaF
      */
     public static String getPreferredLafCommand() {
-        String laf = PREFS.get(USER_PREFS_KEY, null);
+        String laf = "laf:com.apple.laf.AquaLookAndFeel";
         if (laf != null) {
             return laf;
         }

Start JMeter with ./gradlew runGui

Will it launch?

I just pull the project and run it without any change, it is successful.
It looks like not reproducible in 5.6.3 version.
The 5.6.2 from homebrew is the same error.
Screenshot 2023-10-07 at 08 42 49

@ShanChathusanda93
Copy link

Facing the same issue. Anyone know a release timeline for the 5.6.3 because seems like the issue is fixed in there (based on the above comment)?

@vlsi
Copy link
Collaborator

vlsi commented Oct 9, 2023

Could you please try downloading and running 5.6.2 from https://jmeter.apache.org/download_jmeter.cgi to rule out homebrew packaging issue?

@zzxrain zzxrain changed the title JMeter cannot be run in macOS Sonoma (Apple Silicon) JMeter cannot be run in macOS Sonoma (Apple Silicon) by Homebrew Oct 9, 2023
@zzxrain
Copy link
Author

zzxrain commented Oct 9, 2023

Could you please try downloading and running 5.6.2 from https://jmeter.apache.org/download_jmeter.cgi to rule out homebrew packaging issue?

Yes, you are right. The binary from Apache Website is working.
I think it is related OpenJDK bundled with Homebrew.
I see it always imports JAVA_HOME by OpenJDK-17 provided by brew in /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"  "$@"

After edited as below (Then it will use my configured JDK instead of provided by Homebrew), it works.

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

@andrekiba
Copy link

andrekiba commented Oct 14, 2023

the same fix as @zzxrain doesn't work for me, m1 with Sonoma

  • installed jmeter using homebrew
  • installed the openjdk@21 with homebrew
  • changed the jmeter file in this way
    #!/bin/bash JAVA_HOME="/opt/homebrew/opt/openjdk@21" exec "/opt/homebrew/Cellar/jmeter/5.6.2/libexec/bin/jmeter" "$@"

if I remove the JAVA_HOME from the file I still have the same issue

if I try to download from https://jmeter.apache.org/download_jmeter.cgi I have the same issue

Any help?

@zzxrain
Copy link
Author

zzxrain commented Oct 17, 2023

the same fix as @zzxrain doesn't work for me, m1 with Sonoma

  • installed jmeter using homebrew
  • installed the openjdk@21 with homebrew
  • changed the jmeter file in this way
    #!/bin/bash JAVA_HOME="/opt/homebrew/opt/openjdk@21" exec "/opt/homebrew/Cellar/jmeter/5.6.2/libexec/bin/jmeter" "$@"

if I remove the JAVA_HOME from the file I still have the same issue

if I try to download from https://jmeter.apache.org/download_jmeter.cgi I have the same issue

Any help?

Hi, could you try with amazon-corretto instead of JDK provided by homebrew ?

@joshelson
Copy link

Same issue for me here, but manually running this:

JAVA_HOME="/opt/homebrew/opt/openjdk@21" exec "/opt/homebrew/Cellar/jmeter/5.6.2/libexec/bin/jmeter"

So far seems to be OK.

@ACACIANh
Copy link

ACACIANh commented Oct 25, 2023

I have same issue
openjdk 17.0.5
Sonoma 14.0
brew install jmeter
I executed success in this link https://jmeter.apache.org/download_jmeter.cgi
but it's have to know binary file path for execute.
there is no other way?

@hendisantika
Copy link

I have same issue:

  1. openJDK 21 using sdkman
  2. Sonoma 14.0
  3. brew install jmeter

I executed success in this link https://jmeter.apache.org/download_jmeter.cgi
but it's have to know binary file path for execute.
is there any other way? ✏️📗:octocat:⬆

Thanks

@belt
Copy link

belt commented Oct 30, 2023

uname -r # => 23.1.0
uname -m # => arm64
brew install corretto

# => successful launch on an M1
JAVA_HOME=/Library/Java/JavaVirtualMachines/amazon-corretto-21.jdk/Contents/Home/ exec /opt/homebrew/Cellar/jmeter/5.6.2/libexec/bin/jmeter

@jourquin
Copy link

jourquin commented Nov 1, 2023

The problem seems to appear for any java app that uses the native macOS "Screen menu bars" setting

System.setProperty("apple.laf.useScreenMenuBar", "true");

This affects macOS Sonoma systems with a Homebrew OpenJDK.

A quick and dirty fix (in the java code) is to avoid setting this property on affected systems. A example can be found at the end of the following code :
https://github.com/jourquin/Nodus/blob/master/src/edu/uclouvain/core/nodus/Nodus.java

The test is used in line 253.

Obviously, the menu bar will be in the main application window, and not on the top of the screen, which is not a standard behavior for macOS applications.

@pmedish1
Copy link

pmedish1 commented Nov 2, 2023

uname -r # => 23.1.0
uname -m # => arm64
brew install corretto

# => successful launch on an M1
JAVA_HOME=/Library/Java/JavaVirtualMachines/amazon-corretto-21.jdk/Contents/Home/ exec /opt/homebrew/Cellar/jmeter/5.6.2/libexec/bin/jmeter

This worked for me when I run it command line instead of in the .zshrc file

@RukshanJS
Copy link

RukshanJS commented Nov 3, 2023

uname -r # => 23.1.0
uname -m # => arm64
brew install corretto

# => successful launch on an M1
JAVA_HOME=/Library/Java/JavaVirtualMachines/amazon-corretto-21.jdk/Contents/Home/ exec /opt/homebrew/Cellar/jmeter/5.6.2/libexec/bin/jmeter

After so much hours wasted on this. This is the only solution that really worked. Thanks! 🎉

@hendisantika
Copy link

uname -r # => 23.0.1
uname -m # => arm64
brew install corretto

It doesn't work for me

@mard3n
Copy link

mard3n commented Nov 14, 2023

uname -r # 23.0.0
uname -m # arm64

Also works fine with amazon-corretto-21.jdk, but installed it manually
https://docs.aws.amazon.com/corretto/latest/corretto-21-ug/macos-install.html

@RukshanJS
Copy link

uname -r # => 23.0.1 uname -m # => arm64 brew install corretto

It doesn't work for me

what issue are you facing? "doesn't work" is not enough to help out.

@hendisantika
Copy link

JMeter not running after I installed those things @RukshanJS ...

@Forfend
Copy link

Forfend commented Nov 16, 2023

uname -r # => 23.1.0
uname -m # => arm64
brew install corretto

# => successful launch on an M1
JAVA_HOME=/Library/Java/JavaVirtualMachines/amazon-corretto-21.jdk/Contents/Home/ exec /opt/homebrew/Cellar/jmeter/5.6.2/libexec/bin/jmeter

will it work if I use sdkman to manage Java versions?

@hendisantika
Copy link

I am using SDKMAN. But still doesn't work

@RukshanJS
Copy link

I'll try to make a small tutorial on this. LMK if you can't still get it working.

@hendisantika
Copy link

I'll try to make a small tutorial on this. LMK if you can't still get it working.

I can't wait for it.

Thanks

@Oesoto
Copy link

Oesoto commented Nov 24, 2023

Running the long command

JAVA_HOME=/Library/Java/JavaVirtualMachines/amazon-corretto-21.jdk/Contents/Home/ exec /opt/homebrew/Cellar/jmeter/5.6.2/libexec/bin/jmeter

Works for me. Is there any way to make it work by just calling the jmeter command?

@RukshanJS
Copy link

RukshanJS commented Nov 25, 2023

@hendisantika @Oesoto I have covered the fix (including how to run with just jmeter command) on my youtube channel. Check it out and let me know comments. Also if it helps, kindly post comments over there.

https://youtu.be/5OlvuWOAu7o?si=paDMiE_XXN5o7Uyl

Happy testing!

P.S. - just published the video and would take some time to process to higher qualities.

@hendisantika
Copy link

OK Good. Thanks @RukshanJS

@hendisantika
Copy link

Well done. Thanks a lot @RukshanJS

Now, It's working

@RukshanJS
Copy link

Well done. Thanks a lot @RukshanJS

Now, It's working

Awesome! Super glad it helped. Feedback much appreciated

@Oesoto
Copy link

Oesoto commented Nov 25, 2023

@RukshanJS

Thanks. Everything is working fine now.

I found this issue when setting up a new M3 machine.

I also use a M1 machine that I've used with Jmeter 5.4.3 for a long time and I recently updated it from Ventura to Sonoma and Jmeter continued working normally without the need to install corretto. So maybe downgrading to an older version can be another possible workaround.

@mariasu11
Copy link

@hendisantika @Oesoto I have covered the fix (including how to run with just jmeter command) on my youtube channel. Check it out and let me know comments. Also if it helps, kindly post comments over there.

https://youtu.be/5OlvuWOAu7o?si=paDMiE_XXN5o7Uyl

Happy testing!

P.S. - just published the video and would take some time to process to higher qualities.

This worked for me!!! Thank you!

@ca-milin15
Copy link

uname -r # => 23.1.0
uname -m # => arm64
brew install corretto

# => successful launch on an M1
JAVA_HOME=/Library/Java/JavaVirtualMachines/amazon-corretto-21.jdk/Contents/Home/ exec /opt/homebrew/Cellar/jmeter/5.6.2/libexec/bin/jmeter

After so much hours wasted on this. This is the only solution that really worked. Thanks! 🎉

It worked very well for me. Thanks so much.
PD: I have Sonoma 14.1.2 and M1 chip

@zzxrain
Copy link
Author

zzxrain commented Jan 26, 2024

This issue is fixed by latest Homebrew, hence close it.

@zzxrain zzxrain closed this as completed Jan 26, 2024
@prineshaz
Copy link

prineshaz commented Feb 13, 2024

uname -r # => 23.1.0
uname -m # => arm64
brew install corretto

# => successful launch on an M1
JAVA_HOME=/Library/Java/JavaVirtualMachines/amazon-corretto-21.jdk/Contents/Home/ exec /opt/homebrew/Cellar/jmeter/5.6.2/libexec/bin/jmeter

This worked, however jmeter version has been updated since, so changed /opt/homebrew/Cellar/jmeter/5.6.2/libexec/bin/jmeter to 5.6.3, please note the jmeter version and apply accordingly.

@paulpacaud
Copy link

This issue is fixed by latest Homebrew, hence close it.

wrong, the issue is still existing as of August, the 16th, 2024 :(

@paulpacaud
Copy link

I fixed the issue uninstalling the package using brew uninstall jmeter, and then installing manually jmeter following this youtube tutorial:
https://www.youtube.com/watch?v=tPKe6eYnlUk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests