无法通过JMeter发送HTTP2请求
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了无法通过JMeter发送HTTP2请求相关的知识,希望对你有一定的参考价值。
我已根据我的Java版本下载了alpn-boot文件:Java版本“ 1.8.0_151”-> ALPN版本为8.1.11.v20170118(根据https://www.eclipse.org/jetty/documentation/9.4.x/alpn-chapter.html#alpn-versions)。另外,我已经将alpn-boot文件的路径添加到jmeter.bat:
set JVM_ARGS= -Xbootclasspath/p:D:apache-jmeter-5.1apache-jmeter-5.1libalpn-boot-8.1.11.v20170118.jar
@echo off
rem Licensed to the Apache Software Foundation (ASF) under one or more
rem contributor license agreements. See the NOTICE file distributed with
...
但是我在JMeter中收到一条错误消息:
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.executeSamplePackage(JMeterThread.java:475)
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:418)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:249)
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.NoClassDefFoundError: org/eclipse/jetty/alpn/ALPN
at org.eclipse.jetty.alpn.java.client.OpenJDK8ClientALPNProcessor.init(OpenJDK8ClientALPNProcessor.java:42)
at org.eclipse.jetty.alpn.client.ALPNClientConnectionFactory.<init>(ALPNClientConnectionFactory.java:77)
... 8 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.alpn.ALPN
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 10 more
我想这个问题与jmeter.bat文件中的alpn路径有关,但是如何解决?
- 首先确保JMeter使用Java 1.8.0_151并采用
-Xbootclasspath
参数,您可以通过添加JSR223 Sampler并使用以下Groovy代码来做到这一点:log.info('Java version: ' + System.getProperty('java.version')) java.lang.management.ManagementFactory.getRuntimeMXBean().getInputArguments().each { log.info("Effective JVM argument: " + "$it") }
您应该获得如下输出:
- 检查
alpn-boot
文件是否在[[真正: set JVM_ARGS="-Xbootclasspath/p:D:apache-jmeter-5.1apache-jmeter-5.1libalpn-boot-8.1.11.v20170118.jar;"
清理输入,即删除空格,在末尾添加分号,并用引号引起来的值:
如果一切顺利,您应该能够成功执行HTTP2请求:
更多信息:The New HTTP/2 Plugin for JMeter
以上是关于无法通过JMeter发送HTTP2请求的主要内容,如果未能解决你的问题,请参考以下文章
HTTP2 请求示例使用 Jmeter4 崩溃,Java 10 No Client ALPNProcessors
无法向 Apache 服务器发出 http2 请求,尽管服务器在响应标头中发送“升级:h2”
如何使用 Node.js 通过代理发送 HTTP/2 请求?