Hi All,

I am trying to use UltimateThreadGroup with the JMeter Java API, I am
creating the UltimateThreadGroup object as in the below code[2] and add it
to the Hashtree.

Finally handover it to the JMeter engine to execute.

But It gives the following NullPointerException in the middle of exception.
As I debugged the code, the Issue seems occure inside JMeterThread class
following method.

public JMeterThread(HashTree test, JMeterThreadMonitor monitor,
ListenerNotifier note, Boolean isSameUserOnNextIteration)


But issue throws on different lines from execution to execution.

Does anybody have an idea on whats going on here? Appreciate your answers.

[1]
2020-11-03 13:08:20 DEBUG TestCompiler:273 - adding controller:
kg.apc.jmeter.threads.UltimateThreadGroup@30b2b76f to sampler config
2020-11-03 13:08:22 ERROR JMeterThread:319 - Test failed!
java.lang.NullPointerException
at
org.apache.jmeter.threads.AbstractThreadGroup.addTestElement(AbstractThreadGroup.java:122)
at
org.apache.jmeter.threads.AbstractThreadGroup.addTestElementOnce(AbstractThreadGroup.java:131)
at
org.apache.jmeter.threads.TestCompiler.subtractNode(TestCompiler.java:151)
at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:997)
at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:994)
at org.apache.jorphan.collections.HashTree.traverse(HashTree.java:976)
at org.apache.jmeter.threads.JMeterThread.initRun(JMeterThread.java:704)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:252)
at java.lang.Thread.run(Thread.java:748)

[2]

UltimateThreadGroup ultimateThreadGroup = new UltimateThreadGroup();
ultimateThreadGroup.setName(threadGroupName);
ultimateThreadGroup.setProperty(AbstractThreadGroup.ON_SAMPLE_ERROR,
AbstractThreadGroup.ON_SAMPLE_ERROR_CONTINUE);
PowerTableModel dataModel = new
PowerTableModel(UltimateThreadGroupGui.columnIdentifiers,
UltimateThreadGroupGui.columnClasses);
dataModel.addRow(new Integer[]{2, 4, 10, 60, 10});
dataModel.addRow(new Integer[]{3, 4, 10, 120, 10});
CollectionProperty prop =
JMeterPluginsUtils.tableModelRowsToCollectionProperty(dataModel,
UltimateThreadGroup.DATA_PROPERTY);
ultimateThreadGroup.setData(prop);
ultimateThreadGroup.setEnabled(setEnabled);
ultimateThreadGroup.setProperty(TestElement.TEST_CLASS,
UltimateThreadGroup.class.getName());
ultimateThreadGroup.setProperty(TestElement.GUI_CLASS,
UltimateThreadGroupGui.class.getName());

Reply via email to