Jmeter中的RemoteJMeterEngineImpl类,如何创建实例并调用rconfigure 议程-从localhost Java类调用远程区域的JMeter

Jmeter中的RemoteJMeterEngineImpl类,如何创建实例并调用rconfigure 议程-从localhost Java类调用远程区域的JMeter,java,jmeter,jmeter-plugins,Java,Jmeter,Jmeter Plugins,我发现RemoteJMeterEngineImpl类有助于调用远程区域的JMeter 问题-由于私有构造函数,无法创建RemoteJMeterEngineImpl类的实例 如果有人知道如何使用RemoteJMeterEngineImpl类,请提供帮助,您需要致电 RemoteJMeterEngineImpl.startServer(rmiPort); 代码: 你正在做一些奇怪的事情,而且绝对不受支持。通常情况下,您应该让远程从站启动并运行,如果您需要以编程方式启动测试,我相信这是您可以使用的

我发现RemoteJMeterEngineImpl类有助于调用远程区域的JMeter

问题-由于私有构造函数,无法创建RemoteJMeterEngineImpl类的实例

如果有人知道如何使用RemoteJMeterEngineImpl类,请提供帮助,您需要致电

RemoteJMeterEngineImpl.startServer(rmiPort);
代码:


你正在做一些奇怪的事情,而且绝对不受支持。通常情况下,您应该让远程从站启动并运行,如果您需要以编程方式启动测试,我相信这是您可以使用的

示例代码:

List<JMeterEngine> engines = new LinkedList<>();
Properties remoteProps = new Properties();
//set properties you want to send to remote clients here
DistributedRunner distributedRunner=new DistributedRunner(remoteProps);

List<String> hosts = new LinkedList<>();
//add your JMeter slaves here
hosts.add("remote_host_1");
hosts.add("remote_host_2");
distributedRunner.setStdout(System.out);
distributedRunner.setStdErr(System.err);
distributedRunner.init(hosts, testPlanTree);
engines.addAll(distributedRunner.getEngines());
distributedRunner.start();
List engines=newlinkedlist();
Properties remoteProps=新属性();
//在此处设置要发送到远程客户端的属性
DistributedRunner DistributedRunner=新的DistributedRunner(remoteProps);
列表主机=新的LinkedList();
//在此处添加JMeter从属
添加(“远程主机1”);
添加(“远程主机2”);
分布式Runner.SetstOut(系统输出);
distributedRunner.setStdErr(System.err);
init(hosts,testPlanTree);
engines.addAll(distributedRunner.getEngines());
distributeRunner.start();

有关JMeter测试的编程创建和执行的更多信息,请参阅文章和示例项目

欢迎来到StackOverflow,请花一点时间回顾本教程:,如何创建一个最小的、完整的、可验证的示例:,更具体地说,如何提出好的问题-如果您在来SO寻求帮助之前对问题进行一些思考,您将得到更好的反馈和有用的答案,通过在代码中包含一个特定的问题,您已经尝试展示自己解决问题的努力。你可以编辑你的文章,一旦你有一个具体的问题的想法。谢谢你,因为我下面提到的步骤,我面临以下例外。rconfigure()方法java.rmi.ServerException中出错:服务器线程中发生RemoteException;嵌套的异常是:java.rmi.UnmarshalException:error unmarshalling参数;嵌套异常为:java.io.InvalidClassException:org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;本地类不兼容:stream classdesc serialVersionUID=240,本地类serialVersionUID=241远程引擎已启动您需要在主服务器和从服务器上使用相同版本的JMeter机器JMeter版本(3.1)和JDK(jdk1.8.0131)相同,仍然面临异常。我能够从命令行成功地调用它。如果我收到您的电子邮件ID,我想发送类文件我们是否需要在远程计算机上配置rmiregistry以外的任何东西?
List<JMeterEngine> engines = new LinkedList<>();
Properties remoteProps = new Properties();
//set properties you want to send to remote clients here
DistributedRunner distributedRunner=new DistributedRunner(remoteProps);

List<String> hosts = new LinkedList<>();
//add your JMeter slaves here
hosts.add("remote_host_1");
hosts.add("remote_host_2");
distributedRunner.setStdout(System.out);
distributedRunner.setStdErr(System.err);
distributedRunner.init(hosts, testPlanTree);
engines.addAll(distributedRunner.getEngines());
distributedRunner.start();