当前位置: 首页 > 知识库问答 >
问题:

使用JMeter的HTTP/2请求以“nullsession”(jetty-alpn)失败

应和光
2023-03-14

我已经为JMeter安装了Blazemeter HTTP/2插件,但很难让HTTP/2请求工作。

  • 线程组
    • HTTP2请求
      • 服务器:stackoverflow.com
      • 协议:https
      Thread Name:Thread Group 1-1
      Sample Start:1970-01-01 01:00:00 CET
      Load time:0
      Connect Time:0
      Latency:0
      Size in bytes:2700
      Sent bytes:0
      Headers size in bytes:0
      Body size in bytes:2700
      Sample Count:1
      Error Count:1
      Data type ("text"|"bin"|""):text
      Response code:Non HTTP response code: java.util.concurrent.ExecutionException
      Response message:Non HTTP response message: org.eclipse.jetty.io.RuntimeIOException: javax.net.ssl.SSLHandshakeException: nullSession
      
      
      HTTP2SampleResult fields:
      ContentType: 
      DataEncoding: null
      
      2020-07-03 12:58:13,457 WARN o.a.j.v.ViewResultsFullVisualizer: Error loading result renderer: org.apache.jmeter.visualizers.RenderInBrowser
      java.lang.NoClassDefFoundError: javafx/embed/swing/JFXPanel
          at java.lang.Class.forName0(Native Method) ~[?:1.8.0_252]
          at java.lang.Class.forName(Class.java:264) ~[?:1.8.0_252]
          at com.blazemeter.jmeter.http2.visualizers.ViewResultsFullVisualizer.createComboRender(ViewResultsFullVisualizer.java:396) ~[jmeter-bzm-http2-1.5.jar:?]
          at com.blazemeter.jmeter.http2.visualizers.ViewResultsFullVisualizer.createLeftPanel(ViewResultsFullVisualizer.java:322) ~[jmeter-bzm-http2-1.5.jar:?]
          at com.blazemeter.jmeter.http2.visualizers.ViewResultsFullVisualizer.init(ViewResultsFullVisualizer.java:283) ~[jmeter-bzm-http2-1.5.jar:?]
          at com.blazemeter.jmeter.http2.visualizers.ViewResultsFullVisualizer.<init>(ViewResultsFullVisualizer.java:118) ~[jmeter-bzm-http2-1.5.jar:?]
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_252]
          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_252]
          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_252]
          at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_252]
          at org.apache.jmeter.gui.GuiPackage.getGuiFromCache(GuiPackage.java:405) ~[ApacheJMeter_core.jar:5.2.1]
          at org.apache.jmeter.gui.GuiPackage.createTestElement(GuiPackage.java:352) ~[ApacheJMeter_core.jar:5.2.1]
          at org.apache.jmeter.gui.action.AddToTree.doAction(AddToTree.java:68) ~[ApacheJMeter_core.jar:5.2.1]
          at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:88) ~[ApacheJMeter_core.jar:5.2.1]
          at org.apache.jmeter.gui.action.ActionRouter.lambda$actionPerformed$0(ActionRouter.java:70) ~[ApacheJMeter_core.jar:5.2.1]
          at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) [?:1.8.0_252]
          at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) [?:1.8.0_252]
          at java.awt.EventQueue.access$500(EventQueue.java:97) [?:1.8.0_252]
          at java.awt.EventQueue$3.run(EventQueue.java:709) [?:1.8.0_252]
          at java.awt.EventQueue$3.run(EventQueue.java:703) [?:1.8.0_252]
          at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_252]
          at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) [?:1.8.0_252]
          at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) [?:1.8.0_252]
          at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205) [?:1.8.0_252]
          at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) [?:1.8.0_252]
          at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) [?:1.8.0_252]
          at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) [?:1.8.0_252]
          at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) [?:1.8.0_252]
          at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) [?:1.8.0_252]
      Caused by: java.lang.ClassNotFoundException: javafx.embed.swing.JFXPanel
          at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[?:1.8.0_252]
          at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[?:1.8.0_252]
          at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_252]
          ... 29 more
      2020-07-03 12:58:19,743 INFO o.a.j.e.StandardJMeterEngine: Running the test!
      2020-07-03 12:58:19,745 INFO o.a.j.s.SampleEvent: List of sample_variables: []
      2020-07-03 12:58:19,751 INFO o.a.j.g.u.JMeterMenuBar: setRunning(true, *local*)
      2020-07-03 12:58:20,368 INFO o.a.j.e.StandardJMeterEngine: Starting ThreadGroup: 1 : Thread Group
      2020-07-03 12:58:20,371 INFO o.a.j.e.StandardJMeterEngine: Starting 1 threads for group Thread Group.
      2020-07-03 12:58:20,372 INFO o.a.j.e.StandardJMeterEngine: Thread will continue on error
      2020-07-03 12:58:20,373 INFO o.a.j.t.ThreadGroup: Starting thread group... number=1 threads=1 ramp-up=1 delayedStart=false
      2020-07-03 12:58:20,376 INFO o.a.j.t.ThreadGroup: Started thread group number 1
      2020-07-03 12:58:20,376 INFO o.a.j.e.StandardJMeterEngine: All thread groups have been started
      2020-07-03 12:58:20,381 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-1
      2020-07-03 12:58:20,489 WARN o.e.j.i.SelectorManager: Exception while notifying connection SslConnection@694fa68a::SocketChannelEndPoint@65c6505a{stackoverflow.com/151.101.129.69:443<->/192.168.0.178:34818,CLOSED,fill=-,flush=-,to=2/30000}{io=1/1,kio=-1,kro=-1}->SslConnection@694fa68a{NEED_UNWRAP,eio=-1/-1,di=-1,fill=IDLE,flush=IDLE}~>DecryptedEndPoint@58ec6f77{stackoverflow.com/151.101.129.69:443<->/192.168.0.178:34818,CLOSED,fill=-,flush=-,to=10/30000}=>ALPNClientConnection@1d8fc708
      org.eclipse.jetty.io.RuntimeIOException: javax.net.ssl.SSLHandshakeException: nullSession
          at org.eclipse.jetty.io.NegotiatingClientConnection.onOpen(NegotiatingClientConnection.java:72) ~[jetty-io-9.4.26.v20200117.jar:9.4.26.v20200117]
          at org.eclipse.jetty.io.ssl.SslConnection.onOpen(SslConnection.java:360) ~[jetty-io-9.4.26.v20200117.jar:9.4.26.v20200117]
          at org.eclipse.jetty.io.SelectorManager.connectionOpened(SelectorManager.java:324) [jetty-io-9.4.26.v20200117.jar:9.4.26.v20200117]
          at org.eclipse.jetty.io.ManagedSelector.createEndPoint(ManagedSelector.java:276) [jetty-io-9.4.26.v20200117.jar:9.4.26.v20200117]
          at org.eclipse.jetty.io.ManagedSelector.access$1800(ManagedSelector.java:62) [jetty-io-9.4.26.v20200117.jar:9.4.26.v20200117]
          at org.eclipse.jetty.io.ManagedSelector$CreateEndPoint.run(ManagedSelector.java:933) [jetty-io-9.4.26.v20200117.jar:9.4.26.v20200117]
          at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806) [jetty-util-9.4.26.v20200117.jar:9.4.26.v20200117]
          at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938) [jetty-util-9.4.26.v20200117.jar:9.4.26.v20200117]
          at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]
      Caused by: javax.net.ssl.SSLHandshakeException: nullSession
          at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.handshakeFailed(SslConnection.java:933) ~[jetty-io-9.4.26.v20200117.jar:9.4.26.v20200117]
          at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.flush(SslConnection.java:1142) ~[jetty-io-9.4.26.v20200117.jar:9.4.26.v20200117]
          at org.eclipse.jetty.io.NegotiatingClientConnection.onOpen(NegotiatingClientConnection.java:63) ~[jetty-io-9.4.26.v20200117.jar:9.4.26.v20200117]
          ... 8 more
      Caused by: java.lang.NoSuchFieldError: nullSession
          at sun.security.ssl.ClientHandshaker.getKickstartMessage(ClientHandshaker.java:1350) ~[?:1.8.0_252]
          at sun.security.ssl.Handshaker.kickstart(Handshaker.java:1117) ~[?:1.8.0_252]
          at sun.security.ssl.SSLEngineImpl.kickstartHandshake(SSLEngineImpl.java:736) ~[?:1.8.0_252]
          at sun.security.ssl.SSLEngineImpl.writeAppRecord(SSLEngineImpl.java:1232) ~[?:1.8.0_252]
          at sun.security.ssl.SSLEngineImpl.wrap(SSLEngineImpl.java:1185) ~[?:1.8.0_252]
          at javax.net.ssl.SSLEngine.wrap(SSLEngine.java:511) ~[?:1.8.0_252]
          at org.eclipse.jetty.io.ssl.SslConnection.wrap(SslConnection.java:412) ~[jetty-io-9.4.26.v20200117.jar:9.4.26.v20200117]
          at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.flush(SslConnection.java:1052) ~[jetty-io-9.4.26.v20200117.jar:9.4.26.v20200117]
          at org.eclipse.jetty.io.NegotiatingClientConnection.onOpen(NegotiatingClientConnection.java:63) ~[jetty-io-9.4.26.v20200117.jar:9.4.26.v20200117]
          ... 8 more
      2020-07-03 12:58:20,494 WARN o.e.j.i.ManagedSelector: org.eclipse.jetty.io.RuntimeIOException: javax.net.ssl.SSLHandshakeException: nullSession
      2020-07-03 12:58:20,498 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-1
      2020-07-03 12:58:20,498 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-1
      2020-07-03 12:58:20,499 INFO o.a.j.e.StandardJMeterEngine: Notifying test listeners of end of test
      2020-07-03 12:58:20,500 INFO o.a.j.g.u.JMeterMenuBar: setRunning(false, *local*)
      

      如果将协议更改为HTTP,则会得到以下采样器结果:

      Thread Name:Thread Group 1-1
      Sample Start:2020-07-03 13:11:59 CEST
      Load time:0
      Connect Time:354
      Latency:0
      Size in bytes:1072
      Sent bytes:0
      Headers size in bytes:0
      Body size in bytes:1072
      Sample Count:1
      Error Count:1
      Data type ("text"|"bin"|""):text
      Response code:java.util.concurrent.TimeoutException
      Response message:null
      

      这是日志:

      2020-07-03 13:11:58,817 INFO o.a.j.e.StandardJMeterEngine: Running the test!
      2020-07-03 13:11:58,819 INFO o.a.j.s.SampleEvent: List of sample_variables: []
      2020-07-03 13:11:58,824 INFO o.a.j.g.u.JMeterMenuBar: setRunning(true, *local*)
      2020-07-03 13:11:59,307 INFO o.a.j.e.StandardJMeterEngine: Starting ThreadGroup: 1 : Thread Group
      2020-07-03 13:11:59,307 INFO o.a.j.e.StandardJMeterEngine: Starting 1 threads for group Thread Group.
      2020-07-03 13:11:59,307 INFO o.a.j.e.StandardJMeterEngine: Thread will continue on error
      2020-07-03 13:11:59,308 INFO o.a.j.t.ThreadGroup: Starting thread group... number=1 threads=1 ramp-up=1 delayedStart=false
      2020-07-03 13:11:59,309 INFO o.a.j.t.ThreadGroup: Started thread group number 1
      2020-07-03 13:11:59,310 INFO o.a.j.e.StandardJMeterEngine: All thread groups have been started
      2020-07-03 13:11:59,312 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-1
      2020-07-03 13:11:59,690 INFO c.b.j.h.s.HTTP2StreamHandler: Parser for text/html is org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser
      2020-07-03 13:11:59,691 INFO c.b.j.h.s.HTTP2StreamHandler: Parser for application/xhtml+xml is org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser
      2020-07-03 13:11:59,692 INFO c.b.j.h.s.HTTP2StreamHandler: Parser for application/xml is org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser
      2020-07-03 13:11:59,692 INFO c.b.j.h.s.HTTP2StreamHandler: Parser for text/xml is org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser
      2020-07-03 13:11:59,693 INFO c.b.j.h.s.HTTP2StreamHandler: Parser for text/vnd.wap.wml is org.apache.jmeter.protocol.http.parser.RegexpHTMLParser
      2020-07-03 13:11:59,693 INFO c.b.j.h.s.HTTP2StreamHandler: Parser for text/css is org.apache.jmeter.protocol.http.parser.CssParser
      2020-07-03 13:11:59,736 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-1
      2020-07-03 13:11:59,737 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-1
      2020-07-03 13:12:19,741 ERROR c.b.j.h.s.HTTP2SampleResult: Error while await for response
      java.util.concurrent.TimeoutException: null
          at java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1784) ~[?:1.8.0_252]
          at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1928) ~[?:1.8.0_252]
          at com.blazemeter.jmeter.http2.sampler.HTTP2Connection.awaitResponses(HTTP2Connection.java:171) ~[jmeter-bzm-http2-1.5.jar:?]
          at com.blazemeter.jmeter.http2.sampler.HTTP2Request.lambda$waitAllResponses$1(HTTP2Request.java:587) ~[jmeter-bzm-http2-1.5.jar:?]
          at java.util.HashMap$Values.forEach(HashMap.java:981) [?:1.8.0_252]
          at com.blazemeter.jmeter.http2.sampler.HTTP2Request.waitAllResponses(HTTP2Request.java:585) [jmeter-bzm-http2-1.5.jar:?]
          at com.blazemeter.jmeter.http2.sampler.HTTP2Request.threadFinished(HTTP2Request.java:548) [jmeter-bzm-http2-1.5.jar:?]
          at org.apache.jmeter.threads.JMeterThread$ThreadListenerTraverser.addNode(JMeterThread.java:774) [ApacheJMeter_core.jar:5.2.1]
          at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:994) [jorphan.jar:5.2.1]
          at org.apache.jorphan.collections.HashTree.traverse(HashTree.java:977) [jorphan.jar:5.2.1]
          at org.apache.jmeter.threads.JMeterThread.threadFinished(JMeterThread.java:741) [ApacheJMeter_core.jar:5.2.1]
          at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:329) [ApacheJMeter_core.jar:5.2.1]
          at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]
      2020-07-03 13:12:19,756 INFO o.a.j.e.StandardJMeterEngine: Notifying test listeners of end of test
      2020-07-03 13:12:19,758 INFO o.a.j.g.u.JMeterMenuBar: setRunning(false, *local*)
      

      我在Linux上使用JMeter 5.2.1和OpenJDK 8(OpenJDK版本“1.8.0_252”)(版本5.6.15-arch1-1)

      (在Ubuntu 20.04上使用JMeter 5.3得到了相同的结果,运行在CLI模式下)

      JVM_ARGS="-Xbootclasspath/p:/opt/jmeter/lib/alpn-boot-8.1.13.v20181017.jar"
      

      该表只显示了到OpenJDK8U242的映射,这是最后一个需要ALPN引导JAR的版本。

      但是,如果在没有alpn参数的情况下启动JMeter,我会看到如下结果(HTTP/2 with HTTPS):

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

共有1个答案

仇正豪
2023-03-14

正如我发现的那样,OpenJDK8U252和Jetty 9.4.26(随JMeter一起提供)的组合是不兼容的。

ALPN API已经被后移到Java8U252和Jetty9.4.28,不再需要alpn-boot

更多信息:https://webtide.com/jetty-alpn-java-8u252/

    null
lib/jetty-alpn-client-9.4.28.v20200408.jar
lib/jetty-alpn-openjdk8-client-9.4.28.v20200408.jar
lib/jetty-client-9.4.28.v20200408.jar
lib/jetty-http-9.4.28.v20200408.jar
lib/jetty-io-9.4.28.v20200408.jar
lib/jetty-util-9.4.28.v20200408.jar
 类似资料:
  • 问题内容: 在我的JMeter测试中,如果有任何错误,我想触发HTTP请求以在系统上发布消息,以进一步关注。我在这里可以做什么?邮件可视化工具可以很好地通过电子邮件报告错误。我想做同样的事情,但是要通过HTTP请求。我正在使用jmeter 3.2。 问题答案: 您可以执行以下操作: 在HTTP Request采样器之后添加If Controller,并将以下代码放入“条件”区域: 将SMTP Sa

  • 我正在编写一些脚本,以在各个级别测试我们的基础设施。我正在尝试进行测试,以验证使用和不使用http2的客户端的功能。这些文档指定了如何通过覆盖传输来禁用http2。TLSNextProto,但我找不到任何方法要求使用http2。 有没有办法要求http请求只使用http/2?或者如果没有,是否有任何类型的字段或钩子来查看它是否使用了http2?

  • 我回到了JDK8和Jetty和SPDY,我看到现在Jetty 9.2支持ALPN协议而不是NPN协议(参见我的问题,如何在JDK8上运行Jetty和SPDY?)。所以我设置了: 但现在我有个例外: 我使用和jetty 9.2.2.v20140723。

  • 我正在用Java8打这篇文章中提到的相同错误,JMeter 5.1.1版本:Java12 JMeter 5 HTTP/2请求java.lang.NoClassDefFoundError:org/eclipse/jetty/alpn/client/ALPNClientConnectionFactory 我从这里下载了jetty-alpn-java-client并安装在lib目录中并重新启动jmete

  • 这是我的第一个问题。我对API上的http请求有问题。当我发出请求时,控制台上会显示以下错误: 异常:找不到不同类型'对象'的支持对象'[对象对象]'。NgFor仅支持绑定到Iterable,如Array。 每个文件的内容如下: 靴子ts 应用程序。组成部分ts peli.service.ts peli.ts 以及我从请求中收到的JSON文件(输入-蜘蛛侠): 我不知道问题出在哪里,一切似乎都很好

  • 问题内容: 我回到了带有Jetty和SPDY的JDK8,并且看到现在Jetty9.2支持ALPN协议而不是NPN(请参阅我的问题如何在JDK8上使用SPDY运行Jetty?)。所以我设置了: 但是现在我有了例外: 我使用和码头9.2.2.v20140723。 我从JDK 1.7和WinXP 遇到的相同错误,如果从 此执行在我的代码中指向: 似乎即使使用ALPN码头,也需要npn-boot中的类。是