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

▼魔方 西西 提交于 2020-01-02 19:16:07

问题


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 comes with jetty-alpn-client-9.4.9.v20180320.jar by default.

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

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


回答1:


No Client ALPNProcessors! is a message from the Jetty libraries that handle ALPN.

Because you are running in JDK 12 (and I don't think there is any big difference with JDK 11, so JDK 12 should be fine), you must have the jetty-alpn-java-client jar in the classpath, so that the Jetty libraries will find an implementation of the ALPNProcessor.Client class (via the ServiceLoader mechanism) that, as the error shows, cannot be found.

You don't detail how you are setting up TLS, etc. and I would have expected JMeter to have the jetty-alpn-java-client jar in the classpath already, but evidently there is something wrong in your setup (or in JMeter's).

I would double check how JMeter configures TLS; if it is using the standard JDK implementation, then it must have the jetty-alpn-java-client jar in the classpath.

If JMeter is using other TLS implementations (e.g. Conscrypt), then the Jetty project provides similar libraries (e.g. jetty-alpn-conscrypt-client jar) that similarly should be in the classpath.




回答2:


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

Also in JMeter group announcement:

JMeter 5.0 is tested on Java 8 to 10, Java 11 should also work.

Notice also Java 12 isn't 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




回答3:


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.



来源:https://stackoverflow.com/questions/57605428/java-12-jmeter-5-http-2-request-java-lang-noclassdeffounderror-org-eclipse-jett

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!