本文介绍了Java 12 JMeter 5 HTTP/2请求java.lang.NoClassDefFoundError:org/eclipse/jetty/alpn/client/ALPNClientConnectionFactory的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ubuntu 9.0.4上使用Java 12,JMeter 5.1.1,并在尝试发送HTTP/2请求时遇到以下异常:

I am using Java 12, JMeter 5.1.1 on Ubuntu 9.0.4 and bumps into the following exception when trying to send HTTP/2 request:

Response code: Non HTTP response code: java.util.concurrent.ExecutionException
Response message: Non HTTP response message: java.lang.IllegalStateException: No Client ALPNProcessors!

此堆栈跟踪在响应主体中:

And this stack trace in the response body:

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.

JMeter 5.1.1 comes with jetty-alpn-client-9.4.9.v20180320.jar by default.

然后我从 http://central.maven.org/maven2/org/eclipse/jetty/jetty-alpn-java-client/并将其放入安装了jmeter的lib/文件夹中,并导致以下异常:

I then download the jetty alpn java client library from http://central.maven.org/maven2/org/eclipse/jetty/jetty-alpn-java-client/ and put that into jmeter installed lib/ folder and results in this exception:

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,但收到相同的错误.任何建议和见识都将受到赞赏.

I switched to Java 11 but get the same error.Any advice and insight is appreciated.

推荐答案

解决方案:下载 http://central.maven.org/maven2/org/eclipse/jetty/jetty-alpn-java-client/并放入已安装的jmeter lib/文件夹. JMeter仅随jetty-alpn-client一起安装,这还不够.

Solution: Download http://central.maven.org/maven2/org/eclipse/jetty/jetty-alpn-java-client/ and put in the installed jmeter lib/ folder. JMeter only comes installed with jetty-alpn-client which is not enough.

这篇关于Java 12 JMeter 5 HTTP/2请求java.lang.NoClassDefFoundError:org/eclipse/jetty/alpn/client/ALPNClientConnectionFactory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 18:20