Jetty HTTP / 2客户端示例 [英] Jetty HTTP/2 Client example

查看:1342
本文介绍了Jetty HTTP / 2客户端示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了Jetty提供给我们的客户端代码。并发生一些问题。
我想运行的代码是
https://github.com/eclipse/jetty.project/blob/master/jetty-http2/http2-client/src /test/java/org/eclipse/jetty/http2/client/Client.java



其实我知道我遇到了同样的问题,像这个
Jetty HTTP / 2客户端接收服务器推送示例
我停在这个家伙的更新2,我已经在http2-client文件夹下构建了一个新项目。但是问题依然存在。

  INFO :: main:日志初始化@ 170ms 
线程mainjava中的异常.util.concurrent.TimeoutException $ org.eclipse.jetty.util.FuturePromise.get(FuturePromise.java:130)
$ org.eclipse.jetty.http2.client.Client.main(Client。 java:56)

我使用的jar是Jetty-9.3.3。我完全不知道有什么问题。
开发环境是eclipse luna。

解决方案

确保将ALPN jar添加到引导类路径,该jar是您的Java版本的正确版本。请参见下表: https://www.eclipse.org /jetty/documentation/current/alpn-chapter.html#alpn-versions



如果您使用Java版本1.8.0_51,则附加的VM参数应该是:

  -Xbootclasspath / p:/full/path/to/alpn-boot-8.1.4.v20150727。 jar 

我正在得到相同的超时异常,在我的情况下,原来我没有添加alpn-boot jar到引导类路径正确。具体来说,我没有使用完全绝对的路径到jar。如果引导类路径无效,则VM不会发出任何错误。给我绝对的路径解决问题。


I used the client code Jetty provide to us. And some problem occurs. The code I wanna run is here https://github.com/eclipse/jetty.project/blob/master/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/Client.java

And actually I know I come across the same problem like this Jetty HTTP/2 client receive server push example I stopped at this guy's update 2 and I have built a new project under the http2-client folder. But the problem still remains.

INFO::main: Logging initialized @170ms
Exception in thread "main" java.util.concurrent.TimeoutException
at org.eclipse.jetty.util.FuturePromise.get(FuturePromise.java:130)
at org.eclipse.jetty.http2.client.Client.main(Client.java:56)

The jar I use is Jetty-9.3.3. I completely don't know what's wrong. The dev environment is eclipse luna.

解决方案

Make sure you are adding the ALPN jar to the boot classpath and that the jar is the right version for your version of Java. See this table: https://www.eclipse.org/jetty/documentation/current/alpn-chapter.html#alpn-versions

If you are using Java version "1.8.0_51" then the additional VM parameter should be:

-Xbootclasspath/p:/full/path/to/alpn-boot-8.1.4.v20150727.jar

I was getting the same timeout exception, and in my case it turned out that I was not adding the alpn-boot jar to the boot classpath correctly. Specifically, I was not using the full absolute path to the jar. The VM does not give any errors if the boot classpath is invalid. Giving the absolute path fixed the issue for me.

这篇关于Jetty HTTP / 2客户端示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆