Hi!
I want to learn more about the source side of jMeter. I have follow the
instructions on Building and Contributing and import the source project into
Intelij IDEA and can build the project properly. But how can I start a debug
session if I want to do some dynamic analysis on the source.
I found there is a class named org.apache.jmeter.JMeter that with comments said
it was the main class of JMeter. However, it does not contains any main
function and could be started from this class. As the comments of start method
says, it was called by NewDriver.main and determine how to start jmeter.
I tried to start jMeter by NewDriver.main under the launcher module, but it
reported with a ClassNotFoundException(I have added the environment variables
and set the JMeter home to the project directory) :
…lots of outputs…
> Task :src:launcher:NewDriver.main()
BUILD SUCCESSFUL in 27s
3 actionable tasks: 1 executed, 2 up-to-date
java.lang.ClassNotFoundException: org.apache.jmeter.JMeter
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at org.apache.jmeter.NewDriver.main(NewDriver.java:251)
JMeter home directory was detected as: D:\Desktop\apache-jmeter-5.4.1
17:14:09: Task execution finished 'NewDriver.main()'.
Disconnected from the target VM, address: '127.0.0.1:16448', transport: 'socket'
I also tried to add a main method inside the JMeter class which call
JMeter.start directly but get these errors:
…lots of outputs…
> Task :src:core:JMeter.main()
================================================================================
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
================================================================================
17:18:56.313 [AWT-EventQueue-0] ERROR org.apache.jmeter.gui.util.MenuFactory -
Error initializing menus, check configuration if using 3rd party libraries
java.lang.IllegalStateException: null
at java.util.Optional.orElseThrow(Optional.java:290) ~[?:1.8.0_212]
at
org.apache.jmeter.gui.util.MenuFactory.separateItemsWithExplicitOrder(MenuFactory.java:238)
~[main/:?]
at
org.apache.jmeter.gui.util.MenuFactory.<clinit>(MenuFactory.java:109) ~[main/:?]
at
org.apache.jmeter.control.gui.TestPlanGui.createPopupMenu(TestPlanGui.java:94)
~[main/:?]
at
org.apache.jmeter.gui.tree.JMeterTreeNode.createPopupMenu(JMeterTreeNode.java:184)
~[main/:?]
at
org.apache.jmeter.gui.action.EditCommand.doAction(EditCommand.java:46)
~[main/:?]
at
org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:87)
~[main/:?]
at
org.apache.jmeter.gui.action.ActionRouter.lambda$actionPerformed$0(ActionRouter.java:69)
~[main/:?]
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
~[?:1.8.0_212]
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
~[?:1.8.0_212]
at java.awt.EventQueue.access$500(EventQueue.java:97) ~[?:1.8.0_212]
at java.awt.EventQueue$3.run(EventQueue.java:709) ~[?:1.8.0_212]
at java.awt.EventQueue$3.run(EventQueue.java:703) ~[?:1.8.0_212]
at java.security.AccessController.doPrivileged(Native Method)
~[?:1.8.0_212]
at
java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
~[?:1.8.0_212]
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) ~[?:1.8.0_212]
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
~[?:1.8.0_212]
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
~[?:1.8.0_212]
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:109)
~[?:1.8.0_212]
at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:190)
~[?:1.8.0_212]
at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:235)
~[?:1.8.0_212]
at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:233)
~[?:1.8.0_212]
at java.security.AccessController.doPrivileged(Native Method)
~[?:1.8.0_212]
at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:233)
~[?:1.8.0_212]
at java.awt.Dialog.show(Dialog.java:1084) ~[?:1.8.0_212]
at java.awt.Component.show(Component.java:1671) ~[?:1.8.0_212]
at java.awt.Component.setVisible(Component.java:1623) ~[?:1.8.0_212]
at java.awt.Window.setVisible(Window.java:1014) ~[?:1.8.0_212]
at java.awt.Dialog.setVisible(Dialog.java:1005) ~[?:1.8.0_212]
at
org.apache.jmeter.SplashScreen.lambda$showScreen$0(SplashScreen.java:95)
~[main/:?]
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
[?:1.8.0_212]
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
[?:1.8.0_212]
at java.awt.EventQueue.access$500(EventQueue.java:97) [?:1.8.0_212]
at java.awt.EventQueue$3.run(EventQueue.java:709) [?:1.8.0_212]
at java.awt.EventQueue$3.run(EventQueue.java:703) [?:1.8.0_212]
at java.security.AccessController.doPrivileged(Native Method)
~[?:1.8.0_212]
at
java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
[?:1.8.0_212]
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) [?:1.8.0_212]
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
[?:1.8.0_212]
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
[?:1.8.0_212]
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
[?:1.8.0_212]
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
[?:1.8.0_212]
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
[?:1.8.0_212]
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
[?:1.8.0_212]
17:18:56.326 [AWT-EventQueue-0] ERROR org.apache.jmeter.JMeter - Uncaught
exception in thread Thread[AWT-EventQueue-0,6,main]
Uncaught Exception java.lang.ExceptionInInitializerError in thread
Thread[AWT-EventQueue-0,6,main]. See log file for
details.java.lang.ExceptionInInitializerError: null
at
org.apache.jmeter.control.gui.TestPlanGui.createPopupMenu(TestPlanGui.java:94)
~[main/:?]
at
org.apache.jmeter.gui.tree.JMeterTreeNode.createPopupMenu(JMeterTreeNode.java:184)
~[main/:?]
at
org.apache.jmeter.gui.action.EditCommand.doAction(EditCommand.java:46)
~[main/:?]
at
org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:87)
~[main/:?]
at
org.apache.jmeter.gui.action.ActionRouter.lambda$actionPerformed$0(ActionRouter.java:69)
~[main/:?]
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
~[?:1.8.0_212]
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
~[?:1.8.0_212]
at java.awt.EventQueue.access$500(EventQueue.java:97) ~[?:1.8.0_212]
at java.awt.EventQueue$3.run(EventQueue.java:709) ~[?:1.8.0_212]
at java.awt.EventQueue$3.run(EventQueue.java:703) ~[?:1.8.0_212]
at java.security.AccessController.doPrivileged(Native Method)
~[?:1.8.0_212]
at
java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
~[?:1.8.0_212]
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) ~[?:1.8.0_212]
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
~[?:1.8.0_212]
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
~[?:1.8.0_212]
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:109)
~[?:1.8.0_212]
at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:190)
~[?:1.8.0_212]
at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:235)
~[?:1.8.0_212]
at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:233)
~[?:1.8.0_212]
at java.security.AccessController.doPrivileged(Native Method)
~[?:1.8.0_212]
at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:233)
~[?:1.8.0_212]
at java.awt.Dialog.show(Dialog.java:1084) ~[?:1.8.0_212]
at java.awt.Component.show(Component.java:1671) ~[?:1.8.0_212]
at java.awt.Component.setVisible(Component.java:1623) ~[?:1.8.0_212]
at java.awt.Window.setVisible(Window.java:1014) ~[?:1.8.0_212]
at java.awt.Dialog.setVisible(Dialog.java:1005) ~[?:1.8.0_212]
at
org.apache.jmeter.SplashScreen.lambda$showScreen$0(SplashScreen.java:95)
~[main/:?]
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
[?:1.8.0_212]
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
[?:1.8.0_212]
at java.awt.EventQueue.access$500(EventQueue.java:97) [?:1.8.0_212]
at java.awt.EventQueue$3.run(EventQueue.java:709) [?:1.8.0_212]
at java.awt.EventQueue$3.run(EventQueue.java:703) [?:1.8.0_212]
at java.security.AccessController.doPrivileged(Native Method)
~[?:1.8.0_212]
at
java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
[?:1.8.0_212]
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) [?:1.8.0_212]
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
[?:1.8.0_212]
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
[?:1.8.0_212]
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
[?:1.8.0_212]
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
[?:1.8.0_212]
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
[?:1.8.0_212]
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
[?:1.8.0_212]
Caused by: java.lang.IllegalStateException
at java.util.Optional.orElseThrow(Optional.java:290) ~[?:1.8.0_212]
at
org.apache.jmeter.gui.util.MenuFactory.separateItemsWithExplicitOrder(MenuFactory.java:238)
~[main/:?]
at
org.apache.jmeter.gui.util.MenuFactory.<clinit>(MenuFactory.java:109) ~[main/:?]
... 41 more
Caused by: java.lang.IllegalStateException
I checked the sources and its context that throws these exceptions and found
it was throwed for the reason that it cannot found some context menu items.
Although the GUI has poped up, I cannot add any elements under the test plan by
right click it. I think there are some issues in the way I start the jMeter
that I compiled.
Thanks for your replies.