abstracta / jmeter-java-dsl

Simple JMeter performance tests API
https://abstracta.github.io/jmeter-java-dsl/
Apache License 2.0
477 stars 59 forks source link

Remote Testing java.lang.NoSuchMethodException: DistributedJmeterEngine$1.<init>() #269

Closed IvanKvashnin closed 3 months ago

IvanKvashnin commented 5 months ago

java - 21 apache-jmeter - 5.6.3 jmeter-java-dsl - 1.28.1

@Test
void capacity() throws Exception {
    testPlan(
            threadGroup()
                    .rampTo(70, ofHours(7))
                    .children(httpSampler(targetUrl.getNginxUrl()),
                            autoStop().when(errors().total().greaterThan(100L)),
                            influxDbListener(metricUrl.getGrafanaUrl())))
            .runIn(new DistributedJmeterEngineCustom("yourRemoteSlave"));
}

When i start remote testing by dsl instruction, i take error java.lang.NoSuchMethodException: ru.membrana.performancetest.DistributedJmeterEngine$1

INFO 43840 --- [performance-test] [           main] o.a.jmeter.engine.DistributedRunner      : Configuring remote engine:  
192.168.0.116

Configuring remote engine: 192.168.0.116

   java.lang.AssertionError: java.lang.NoSuchMethodException:  
     us.abstracta.jmeter.javadsl.core.engines.DistributedJmeterEngine$1.<init>()

    at org.apache.jmeter.testelement.AbstractTestElement.clone(AbstractTestElement.java:82)
    at org.apache.jmeter.testelement.property.TestElementProperty.clone(TestElementProperty.java:102)
    at org.apache.jmeter.testelement.property.TestElementProperty.clone(TestElementProperty.java:22)
    at org.apache.jmeter.testelement.AbstractTestElement.clone(AbstractTestElement.java:77)
    at org.apache.jmeter.reporters.AbstractListenerElement.clone(AbstractListenerElement.java:51)
    at org.apache.jmeter.engine.TreeCloner.addNodeToTree(TreeCloner.java:76)
    at org.apache.jmeter.engine.TreeCloner.addNode(TreeCloner.java:63)
    at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:993)
    at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:994)
    at org.apache.jorphan.collections.HashTree.traverse(HashTree.java:976)
    at org.apache.jmeter.engine.ClientJMeterEngine.configure(ClientJMeterEngine.java:93)
    at org.apache.jmeter.engine.DistributedRunner.getClientEngine(DistributedRunner.java:233)
    at org.apache.jmeter.engine.DistributedRunner.init(DistributedRunner.java:96)
    at us.abstracta.jmeter.javadsl.core.engines.DistributedJmeterEngine.buildTestRunner(DistributedJmeterEngine.java:144)
    at us.abstracta.jmeter.javadsl.core.engines.EmbeddedJmeterEngine.runInEnv(EmbeddedJmeterEngine.java:116)
    at us.abstracta.jmeter.javadsl.core.engines.DistributedJmeterEngine.run(DistributedJmeterEngine.java:94)
    at us.abstracta.jmeter.javadsl.core.DslTestPlan.runIn(DslTestPlan.java:151)
    at ru.membrana.performancetest.CapacityTest.capacity(CapacityTest.java:33)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: java.lang.NoSuchMethodException: us.abstracta.jmeter.javadsl.core.engines.DistributedJmeterEngine$1.<init>()
    at java.base/java.lang.Class.getConstructor0(Class.java:3761)
    at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2930)
    at org.apache.jmeter.testelement.AbstractTestElement.clone(AbstractTestElement.java:73)
    ... 20 more

Tried different choice:

  1. Create keystore and add in root dir my performance test project
  2. Disable server rmi ssl on slave jmeter and master

For disable server rmi ssl i rewrite class DistributedJmeterEngines and setProperty("server.rmi.ssl.disable", "true");

 @Override
    protected TestRunner buildTestRunner(HashTree testPlanTree,
                                         HashTree rootTree, TestStopper testStopper) {
        JMeterUtils.setProperty("client.rmi.localport", String.valueOf(basePort));
        JMeterUtils.setProperty("server.rmi.ssl.disable", "true");
        EnginesEndListener endListener = new EnginesEndListener(stopEngines);
        testPlanTree.add(endListener);
        distributedRunner.init(hosts, rootTree);
        endListener.setStartedRemoteEngines(new ArrayList<>(distributedRunner.getEngines()));
        return new TestRunner() {

            @Override
            public void runTest() {
                distributedRunner.start();
                try {
                    endListener.await();
                } catch (InterruptedException e) {
                    Thread.currentThread().interrupt();
                }
            }

            @Override
            public void stop() {
                testStopper.stop(null);
            }
        };
    }

I take the same error with DistributedJmeterEngineCustom$1

rabelenda commented 5 months ago

Hello, thank you for asking about this!

Looks like the issue is related to the usage of autoStop with DistributedJmeterEngine. You can try removing the autoStop listener, if that works, then to re add it you should try including in slave nodes the jmeter-java-dsl jar in jmeter class path to be able to use the auto stop Listener in such scenarios.

There is no simple way to automatically add such jar in distributed engine. If anyone has any ideas to solve this problem without manual intervention, they are welcome :).

rabelenda commented 3 months ago

I'm closing this since we haven't had any further comments on the issue.