我安装了Java 1.8.0_151和JMeter 5.1。尝试发送HTTP2请求时出现以下错误:
java.util.concurrent.ExecutionException: java.lang.IllegalStateException: No Client ALPNProcessors!
at org.eclipse.jetty.util.FuturePromise.get(FuturePromise.java:138)
at com.blazemeter.jmeter.http2.sampler.HTTP2Connection.connect(HTTP2Connection.java:69)
at com.blazemeter.jmeter.http2.sampler.HTTP2Request.setConnection(HTTP2Request.java:280)
at com.blazemeter.jmeter.http2.sampler.HTTP2Request.sample(HTTP2Request.java:140)
at com.blazemeter.jmeter.http2.sampler.HTTP2Request.sample(HTTP2Request.java:117)
at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:622)
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:546)
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:486)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:253)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: No Client ALPNProcessors!
at org.eclipse.jetty.alpn.client.ALPNClientConnectionFactory.<init>(ALPNClientConnectionFactory.java:57)
at org.eclipse.jetty.http2.client.HTTP2Client.lambda$doStart$1(HTTP2Client.java:155)
at org.eclipse.jetty.http2.client.HTTP2Client$ClientSelectorManager.newConnection(HTTP2Client.java:438)
at org.eclipse.jetty.io.ManagedSelector.createEndPoint(ManagedSelector.java:222)
at org.eclipse.jetty.io.ManagedSelector.access$1500(ManagedSelector.java:60)
at org.eclipse.jetty.io.ManagedSelector$CreateEndPoint.run(ManagedSelector.java:825)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:754)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:672)
... 1 more
Suppressed: java.lang.IllegalStateException: org.eclipse.jetty.alpn.ALPN must be on JVM boot classpath
at org.eclipse.jetty.alpn.java.client.OpenJDK8ClientALPNProcessor.init(OpenJDK8ClientALPNProcessor.java:43)
at org.eclipse.jetty.alpn.client.ALPNClientConnectionFactory.<init>(ALPNClientConnectionFactory.java:77)
... 8 more
我已经将alpn-boot-8.1.11.v20170118.jar
(根据我的Java版本)下载到jmeter \ lib文件夹,并将以下记录添加到jmeter.bat:set JVM_ARGS="-Xbootclasspath/p:D:\apache-jmeter-5.1\apache-jmeter-5.1\lib\alpn-boot-8.1.11.v20170118.jar;"
。 HTTP2请求仍然无法正确发送。我错过了什么?预先谢谢?
答案 0 :(得分:0)
您的步骤看起来不错,我只能想到2个HTTP2采样器不起作用的原因:
alpn-boot
库的错误路径,您可以使用dir
command进行检查,例如:
dir d:\apache-jmeter-5.1\apache-jmeter-5.1\lib\alpn-boot-8.1.11.v20170118.jar
您应该看到类似以下内容的
:检查JMeter使用的Java版本,因为它可能不是1.8.0_151
,而是PATH中最先出现的Java版本。为了确保JMeter使用正确的Java运行时,可以在jmeter.bat
文件中明确声明它:
set PATH=d:\java\bin;%PATH%
最后,您可以使用JSR223 Sampler打印Java版本和有效的Java参数,相关代码如下所示:
log.info('Java version: ' + System.getProperty('java.version'))
java.lang.management.ManagementFactory.getRuntimeMXBean().getInputArguments().each {
log.info("Effective JVM argument: " + "$it")
}
如果应用了以上清单项,则您应该能够正常执行HTTP2请求:
还要注意,根据9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure,您应该始终使用最新版本的JMeter,因此请考虑升级到JMeter 5.2(或JMeter Downloads页上提供的最新稳定版本)。尽快地。
答案 1 :(得分:0)
还要检查此线程: HTTP2 request sample crashes with Jmeter4, Java 10 No Client ALPNProcessors。 它在这里说: 尤其是,jetty-alpn-openjdk8-client依赖关系无效,不适用于Java 9+。对于Java 9+,应改为使用jetty-alpn-java-client。