简体   繁体   English

如何使用ALPN在SPDY上运行Jetty?

[英]How to run Jetty with SPDY using ALPN?

I have returned to JDK8 with Jetty and SPDY and I see that now Jetty 9.2 supports ALPN protocol instead of NPN (see my question How to run Jetty with SPDY on JDK8? ). 我回到了带有Jetty和SPDY的JDK8,并且看到现在Jetty 9.2支持ALPN协议而不是NPN(请参阅我的问题如何在JDK8上使用SPDY运行Jetty? )。 So I set bootclasspath : 所以我设置了bootclasspath

java -Xbootclasspath/p:c:/jars/alpn-boot/alpn-boot-8.0.0.v2014031 ...

But now I got exception: 但是现在我得到了例外:

Exception in thread "xyz.server" java.lang.NoClassDefFoundError:
        org/eclipse/jetty/npn/NextProtoNego$ServerProvider
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    ...
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnector.<init>(HTTPSPDYServerConnector.java:63)
    at org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnector.<init>(HTTPSPDYServerConnector.java:53)
    at org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnector.<init>(HTTPSPDYServerConnector.java:43)
    at xyz.my.my_httpsrv_jetty.startHTTPSServer(my_httpsrv_jetty.java:359)
    ...

I use java version "1.8.0_05" and jetty 9.2.2.v20140723. 我使用java version "1.8.0_05"和码头9.2.2.v20140723。

The same error I got with JDK 1.7 and alpn-boot-7.0.0.v20140317.jar on WinXP where I changed if from -Xbootclasspath/p:c:/jars/npn-boot/npn-boot-1.1.7.v20140316.jar 我在WinXP上使用JDK 1.7和alpn-boot-7.0.0.v20140317.jar遇到了相同的错误,如果从-Xbootclasspath/p:c:/jars/npn-boot/npn-boot-1.1.7.v20140316.jar我更改了该错误-Xbootclasspath/p:c:/jars/npn-boot/npn-boot-1.1.7.v20140316.jar

This execption points in my code into: 此执行在我的代码中指向:

SSLconnector = new HTTPSPDYServerConnector(server, sslContextFactory);

It seems that even with ALPN jetty needs classes from npn-boot. 似乎即使使用ALPN码头也需要npn-boot中的类。 Is it a bug or I have done something wrong? 是错误还是我做错了什么?

HTTPSPDYServerConnector was not updated to ALPN and currently hardcodes usage of NPN. HTTPSPDYServerConnector未更新为ALPN,当前对NPN的使用进行硬编码。

In order to use ALPN with SPDY you have to configure a ServerConnector instead in this way: 为了在SPDY中使用ALPN,您必须以这种方式配置ServerConnector

SslContextFactory sslContextFactory = new SslContextFactory();
HttpConfiguration httpConfig = new HttpConfiguration();

SslConnectionFactory ssl = new SslConnectionFactory(sslContextFactory, "alpn");
ALPNServerConnectionFactory alpn = new ALPNServerConnectionFactory("spdy/3", "http/1.1");
alpn.setDefaultProtocol("http/1.1");
HTTPSPDYServerConnectionFactory spdy = new HTTPSPDYServerConnectionFactory(SPDY.V3, httpConfig);
HttpConnectionFactory http = new HttpConnectionFactory(httpConfig);

Server server = new Server();
ServerConnector connector = new ServerConnector(server, new ConnectionFactory[]{ssl, alpn, spdy, http});

server.start();

I tracked this as https://bugs.eclipse.org/bugs/show_bug.cgi?id=440756 . 我将其跟踪为https://bugs.eclipse.org/bugs/show_bug.cgi?id=440756

Finally, if you don't use the code directly, but use Jetty as a server and deploy webapps to it, Jetty already configures properly either ALPN or NPN depending on the modules that are activated. 最后,如果您不直接使用代码,而是将Jetty用作服务器并将Webapp部署到该服务器,Jetty已经根据激活的模块正确配置了ALPN或NPN。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用ALPN在Jetty SPDY上使用客户端证书? - How to work with client certificates on Jetty SPDY with ALPN? 如何在JDK8上使用SPDY运行Jetty? - How to run Jetty with SPDY on JDK8? 带码头的SPDY“ Hello服务器” - SPDY “Hello server” with Jetty 使用 google texttospeech 时出错:找不到 TLS ALPN 提供程序; 没有可用的 netty-tcnative、Conscrypt 或 Jetty NPN/ALPN - Error while using google texttospeech : Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available 码头:可以使用SPDY / 3.1吗? - Jetty: is it possible to use SPDY/3.1? ClassNotFoundException: org/eclipse/jetty/alpn/ALPN,但我可以访问这个类 - ClassNotFoundException: org/eclipse/jetty/alpn/ALPN, but I have access to this class java.lang.ClassNotFoundException:org / eclipse / jetty / alpn / ALPN - java.lang.ClassNotFoundException: org/eclipse/jetty/alpn/ALPN ALPN回调被删除:SPDY和HTTP / 2被禁用。 在引导类路径上是alpn-boot吗? - ALPN callback dropped: SPDY and HTTP/2 are disabled. Is alpn-boot on the boot class path? 如何解决“没有正确配置Jetty ALPN或通过netty-tcnative的OpenSSL”? - How to solve “Neither Jetty ALPN nor OpenSSL via netty-tcnative were properly configured”? 码头ALPN / NPN配置不正确 - Jetty ALPN/NPN has not been properly configured
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM