Java 12 JMeter 5 HTTP/2 request java.lang.NoClassDefFoundError: org/eclipse/jetty/alpn/client/ALPNClientConnectionFactory
Java 12 JMeter 5 HTTP/2 request java.lang.NoClassDefFoundError: org/eclipse/jetty/alpn/client/ALPNClientConnectionFactory
我在 Ubuntu 9.0.4 上使用 Java 12,JMeter 5.1.1,在尝试发送 HTTP/2 请求时遇到以下异常:
Response code: Non HTTP response code: java.util.concurrent.ExecutionException
Response message: Non HTTP response message: java.lang.IllegalStateException: No Client ALPNProcessors!
响应正文中的堆栈跟踪:
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:68)
at com.blazemeter.jmeter.http2.sampler.HTTP2Request.setConnection(HTTP2Request.java:278)
at com.blazemeter.jmeter.http2.sampler.HTTP2Request.sample(HTTP2Request.java:138)
at com.blazemeter.jmeter.http2.sampler.HTTP2Request.sample(HTTP2Request.java:115)
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.base/java.lang.Thread.run(Thread.java:835)
Caused by: java.lang.IllegalStateException: No Client ALPNProcessors!
at org.eclipse.jetty.alpn.client.ALPNClientConnectionFactory.<init>(ALPNClientConnectionFactory.java:54)
at org.eclipse.jetty.http2.client.HTTP2Client.lambda$doStart(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.access00(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.run(QueuedThreadPool.java:672)
... 1 more
JMeter 5.1.1 默认自带jetty-alpn-client-9.4.9.v20180320.jar
。
然后我从 http://central.maven.org/maven2/org/eclipse/jetty/jetty-alpn-java-client/ 下载 jetty alpn java 客户端库并将其放入 jmeter 安装的 lib/ 文件夹中,结果出现此异常:
java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: org/eclipse/jetty/alpn/client/ALPNClientConnectionFactory
at org.eclipse.jetty.util.FuturePromise.get(FuturePromise.java:138)
at com.blazemeter.jmeter.http2.sampler.HTTP2Connection.connect(HTTP2Connection.java:68)
at com.blazemeter.jmeter.http2.sampler.HTTP2Request.setConnection(HTTP2Request.java:278)
at com.blazemeter.jmeter.http2.sampler.HTTP2Request.sample(HTTP2Request.java:138)
at com.blazemeter.jmeter.http2.sampler.HTTP2Request.sample(HTTP2Request.java:115)
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.base/java.lang.Thread.run(Thread.java:835)
Caused by: java.lang.NoClassDefFoundError: org/eclipse/jetty/alpn/client/ALPNClientConnectionFactory
at org.eclipse.jetty.http2.client.HTTP2Client.lambda$doStart(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.access00(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.run(QueuedThreadPool.java:672)
... 1 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.alpn.client.ALPNClientConnectionFactory
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:436)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 8 more
我切换到 Java 11 但得到同样的错误。
感谢任何建议和见解。
JMeter 5 doesn't officially support Java 12
JMeter 5.0 officially requires Java 8 or 9, although later versions may be unofficially compatible. From our internal testing, JMeter will run on Java 11
也在 JMeter group 公告中:
JMeter 5.0 is tested on Java 8 to 10, Java 11 should also work.
另请注意 Java 12 不是 Long-Term-Support release
Java SE 11 however is an LTS release, and therefore Oracle Customers will receive Oracle Premier Support and periodic update releases, even though Java SE 12 was released
No Client ALPNProcessors!
是来自处理 ALPN 的 Jetty 库的消息。
因为你是运行在JDK12(而且我觉得和JDK11没有什么大的区别,所以JDK12应该没问题),您必须在 class 路径中包含 jetty-alpn-java-client
jar,这样 Jetty 库才能找到 ALPNProcessor.Client
class 的实现(通过 ServiceLoader
机制),如错误所示,无法找到。
你没有详细说明你是如何设置 TLS 等的,我本以为 JMeter 已经在 class 路径中有 jetty-alpn-java-client
jar,但显然有问题在您的设置中(或在 JMeter 中)。
我会仔细检查 JMeter 如何配置 TLS;如果它使用标准 JDK 实现,那么它必须在 class 路径中包含 jetty-alpn-java-client
jar。
如果 JMeter 使用其他 TLS 实现(例如 Conscrypt),那么 Jetty 项目会提供类似的库(例如 jetty-alpn-conscrypt-client
jar),同样应该在 class 路径中。
解决方法:下载http://central.maven.org/maven2/org/eclipse/jetty/jetty-alpn-java-client/并放入安装的jmeter lib/文件夹。 JMeter 仅安装了 jetty-alpn-client
,这还不够。
我在 Ubuntu 9.0.4 上使用 Java 12,JMeter 5.1.1,在尝试发送 HTTP/2 请求时遇到以下异常:
Response code: Non HTTP response code: java.util.concurrent.ExecutionException
Response message: Non HTTP response message: java.lang.IllegalStateException: No Client ALPNProcessors!
响应正文中的堆栈跟踪:
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:68)
at com.blazemeter.jmeter.http2.sampler.HTTP2Request.setConnection(HTTP2Request.java:278)
at com.blazemeter.jmeter.http2.sampler.HTTP2Request.sample(HTTP2Request.java:138)
at com.blazemeter.jmeter.http2.sampler.HTTP2Request.sample(HTTP2Request.java:115)
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.base/java.lang.Thread.run(Thread.java:835)
Caused by: java.lang.IllegalStateException: No Client ALPNProcessors!
at org.eclipse.jetty.alpn.client.ALPNClientConnectionFactory.<init>(ALPNClientConnectionFactory.java:54)
at org.eclipse.jetty.http2.client.HTTP2Client.lambda$doStart(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.access00(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.run(QueuedThreadPool.java:672)
... 1 more
JMeter 5.1.1 默认自带jetty-alpn-client-9.4.9.v20180320.jar
。
然后我从 http://central.maven.org/maven2/org/eclipse/jetty/jetty-alpn-java-client/ 下载 jetty alpn java 客户端库并将其放入 jmeter 安装的 lib/ 文件夹中,结果出现此异常:
java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: org/eclipse/jetty/alpn/client/ALPNClientConnectionFactory
at org.eclipse.jetty.util.FuturePromise.get(FuturePromise.java:138)
at com.blazemeter.jmeter.http2.sampler.HTTP2Connection.connect(HTTP2Connection.java:68)
at com.blazemeter.jmeter.http2.sampler.HTTP2Request.setConnection(HTTP2Request.java:278)
at com.blazemeter.jmeter.http2.sampler.HTTP2Request.sample(HTTP2Request.java:138)
at com.blazemeter.jmeter.http2.sampler.HTTP2Request.sample(HTTP2Request.java:115)
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.base/java.lang.Thread.run(Thread.java:835)
Caused by: java.lang.NoClassDefFoundError: org/eclipse/jetty/alpn/client/ALPNClientConnectionFactory
at org.eclipse.jetty.http2.client.HTTP2Client.lambda$doStart(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.access00(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.run(QueuedThreadPool.java:672)
... 1 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.alpn.client.ALPNClientConnectionFactory
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:436)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 8 more
我切换到 Java 11 但得到同样的错误。 感谢任何建议和见解。
JMeter 5 doesn't officially support Java 12
JMeter 5.0 officially requires Java 8 or 9, although later versions may be unofficially compatible. From our internal testing, JMeter will run on Java 11
也在 JMeter group 公告中:
JMeter 5.0 is tested on Java 8 to 10, Java 11 should also work.
另请注意 Java 12 不是 Long-Term-Support release
Java SE 11 however is an LTS release, and therefore Oracle Customers will receive Oracle Premier Support and periodic update releases, even though Java SE 12 was released
No Client ALPNProcessors!
是来自处理 ALPN 的 Jetty 库的消息。
因为你是运行在JDK12(而且我觉得和JDK11没有什么大的区别,所以JDK12应该没问题),您必须在 class 路径中包含 jetty-alpn-java-client
jar,这样 Jetty 库才能找到 ALPNProcessor.Client
class 的实现(通过 ServiceLoader
机制),如错误所示,无法找到。
你没有详细说明你是如何设置 TLS 等的,我本以为 JMeter 已经在 class 路径中有 jetty-alpn-java-client
jar,但显然有问题在您的设置中(或在 JMeter 中)。
我会仔细检查 JMeter 如何配置 TLS;如果它使用标准 JDK 实现,那么它必须在 class 路径中包含 jetty-alpn-java-client
jar。
如果 JMeter 使用其他 TLS 实现(例如 Conscrypt),那么 Jetty 项目会提供类似的库(例如 jetty-alpn-conscrypt-client
jar),同样应该在 class 路径中。
解决方法:下载http://central.maven.org/maven2/org/eclipse/jetty/jetty-alpn-java-client/并放入安装的jmeter lib/文件夹。 JMeter 仅安装了 jetty-alpn-client
,这还不够。