gpt4 book ai didi

jmeter - Java 12 JMeter 5 HTTP/2 请求 java.lang.NoClassDefFoundError : org/eclipse/jetty/alpn/client/ALPNClientConnectionFactory

转载 作者:行者123 更新时间:2023-12-03 21:18:31 27 4
gpt4 key购买 nike

我在 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$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

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$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
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 但得到同样的错误。
任何建议和见解表示赞赏。

最佳答案

No Client ALPNProcessors!是来自处理 ALPN 的 Jetty 库的消息。

因为你在JDK 12中运行(我认为与JDK 11没有什么大的区别,所以JDK 12应该没问题),你必须有jetty-alpn-java-client jar 在类路径中,以便 Jetty 库将找到 ALPNProcessor.Client 的实现类(通过 ServiceLoader 机制),如错误所示,无法找到。

您没有详细说明如何设置 TLS 等,我希望 JMeter 拥有 jetty-alpn-java-client jar 已经在类路径中,但显然您的设置(或 JMeter 的设置)有问题。

我会仔细检查 JMeter 如何配置 TLS;如果它使用标准的 JDK 实现,那么它必须具有 jetty-alpn-java-client jar 在类路径中。

如果 JMeter 使用其他 TLS 实现(例如 Conscrypt),则 Jetty 项目提供类似的库(例如 jetty-alpn-conscrypt-client jar),它们同样应该在类路径中。

关于jmeter - Java 12 JMeter 5 HTTP/2 请求 java.lang.NoClassDefFoundError : org/eclipse/jetty/alpn/client/ALPNClientConnectionFactory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57605428/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com