Jetty HTTP/2 Client example

China☆狼群 提交于 2020-01-02 08:09:44

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/32399518/jetty-http-2-client-example

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