Jetty 9.3 HTTP2 dependency issue with Ubuntu 14.04

The other day I was toying around with HTTP2 support and Jetty 9.3 on my Ubuntu Server 14.04 VM install. I had mostly followed the helpful instructions in the Jetty: The Definitive Reference on setting up the application as a web server with support for http, https, deploy modules. But whenever I tried to implement HTTP2 support Jetty would fail with an unhelpful Java error dump.

java -jar /opt/jetty/start.jar --add-to-startd=http2
org.elecipse.jetty.start.graph.GraphException: Missing referenced dependency: alpn-impl/alpn-1.8.0_45-internal
org.eclipse.jetty.start.graph.GraphException: Missing referenced dependency: alpn-impl/alpn-1.8.0_45-internal
at org.eclipse.jetty.start.graph.Graph.selectNodes(
at org.eclipse.jetty.start.graph.Graph.selectNode(
at org.eclipse.jetty.start.graph.Graph.selectNode(
at org.eclipse.jetty.start.Main.processCommandLine(
at org.eclipse.jetty.start.Main.main(

Usage: java -jar start.jar [options] [properties] [configs]
java -jar start.jar --help # for more information

The Jetty log files and Google were equally unhelpful in finding a solution. But after some painful trial and error I worked out a fix.

Jetty’s implementation of HTTP2 requires ALPN support so it can communicate with TLS handshake. Java 8 currently does not support ALPN and so Jetty implements a workaround extension for various versions of OpenJDK.

The Java error is actually telling you that Jetty module alpn-impl, a requirement for http2 is looking for a file dependency that doesn’t exist. The module calling for the dependency can be found at modules/alpn.mod in your jetty home. A look into the file reveals the following.

cat /opt/jetty/modules/alpn.mod


So alpn.mod is using a constant value based on the Java version to generate the dependency name. As it turns out my install of  OpenJDK (openjdk-8-jre-headless) returns an interesting version and this is what is causing the problem.

java -version
openjdk version "1.8.0_45-internal"
OpenJDK Runtime Environment (build 1.8.0_45-internal-b14)
OpenJDK 64-Bit Server VM (build 25.45-b02, mixed mode)

When we take a look in modules/alpn-impl/ there is no such file as 1.8.0_45-internal.mod which matches the Java dependency error message we were receiving.

ls /opt/jetty/modules/alpn-impl
alpn-1.8.0_05.mod alpn-1.8.0_11.mod alpn-1.8.0_20.mod alpn-1.8.0_25.mod alpn-1.8.0_31.mod alpn-1.8.0_40.mod alpn-1.8.0_45.mod alpn-1.8.0.mod

Fortunately the fix is easy.

cd /opt/jetty/modules/alpn-impl/
sudo ln -s alpn-1.8.0_45.mod alpn-1.8.0_45-internal.mod

Now if we try to load the http2 module it works!

cd /opt/jetty
java -jar /opt/jetty/start.jar --add-to-startd=http2
ALERT: There are enabled module(s) with licenses.
The following 1 module(s):
+ contains software not provided by the Eclipse Foundation!
+ contains software not covered by the Eclipse Public License!
+ has not been audited for compliance with its license

Module: alpn
+ ALPN is a hosted at github under the GPL v2 with ClassPath Exception.
+ ALPN replaces/modifies OpenJDK classes in the package.

Proceed (y/N)?

2 thoughts on “Jetty 9.3 HTTP2 dependency issue with Ubuntu 14.04

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s