Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] secure websocket


On Sun, Sep 6, 2015 at 3:23 PM, Hooman Valibeigi <hooman.v@xxxxxxxxx> wrote:
> This question has been asked before
> I have the exact same problem using jetty 9.2.13
> 17:38:21,137 (qtp1382363491-19-selector-ServerConnectorManager@519cb3f8/0)
> DEBUG [] -
> java.lang.NullPointerException

The previous message you linked was not configuring Jetty properly.
Namely, it was configuring the ServerConnector only with the
SslConnectionFactory, telling it to use HTTP/1.1 as the next protocol,
but then the HttpConnectionFactory that handles the HTTP/1.1 protocol
was missing.
You are probably making a similar mistake.

Correct code would be:

Server server = ...;
SslContextFactory sslContextFactory = ...;
HttpConfiguration httpsConfig = ...;
ConnectionFactory ssl = new SslConnectionFactory(sslContextFactory, "http/1.1");
ConnectionFactory http11 = new HttpConnectionFactory(httpsConfig);
ServerConnector connector = new ServerConnector(server, ssl, http11);

Note how the HttpConnectionFactory is added as 3rd argument to ServerConnector.

Simone Bordet
Developer advice, training, services and support
from the Jetty & CometD experts.

Back to the top