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

时间:2019-08-22 08:46:46

标签: http2 jetty-9 jmeter-5.0 java-12 alpn

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

3 个答案:

答案 0 :(得分:3)

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),该类库应类似地位于类路径中。

答案 1 :(得分:1)

JMeter 5 doesn't officially support Java 12

  

JMeter 5.0正式要求Java 8或9,尽管更高版本可能是非正式兼容的。通过我们的内部测试,JMeter将在Java 11上运行

也在JMeter group公告中:

  

JMeter 5.0在Java 8到10上进行了测试,Java 11也应该可以使用。

请注意,Java 12也不是Long-Term-Support release

  

然而,Java SE 11是LTS版本,因此,即使Java SE 12已发布,Oracle客户也将获得Oracle Premier Support和定期更新版本。

答案 2 :(得分:0)

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