Skip to content

Frequently asked questions

Jon Chambers edited this page Jun 17, 2016 · 13 revisions

I'm trying to use Jetty's alpn-boot package, but am seeing a message about "ALPN unsupported." What's wrong?

If alpn-boot isn't set up correctly, you'll probably see an ExceptionInInitializerError that's ultimately caused by something like this:

Caused by: java.lang.RuntimeException: ALPN unsupported. Is your classpatch configured correctly? See http://www.eclipse.org/jetty/documentation/current/alpn-chapter.html#alpn-starting


Usually, this means that `alpn-boot` isn't on your *boot* classpath, which is distinct from your normal classpath. Make sure that you're passing an appropriate `-Xbootclasspath` argument to the JVM that's running your application. Some common pitfalls:

- The profiles from Pushy's own `pom.xml` serve as good examples, but it's important to remember that the only thing they do is set a variable that we ultimately use to set the boot classpath for our unit tests. Copying the profiles into your own project isn't enough; you'll need to make sure that you're actually setting the boot class path when you run your application.
- If your application is running in a container of some kind (Tomcat, for example), you'll need to make sure that the container itself has an appropriate version of `alpn-boot` on its classpath.

### My connections are failing with a `handshake_failure`. What's the problem?

This may mean that your JDK doesn't have the ciphers required by HTTP/2. To the best of our knowledge, only Oracle JDK 8 ships with the requisite ciphers. If you're using something else, you may need to use an alternate JCE provider (like [Bouncy Castle](https://www.bouncycastle.org/)) or a native SSL provider via [`netty-tcnative`](https://github.com/netty/netty-tcnative) (which we recommend as a first choice anyway).

### I sent a bunch of notifications, and lots (but not all) of them failed with an `Http2GoAwayException`. How come?

The odds are good that you're doing something roughly like this:

```java
for (final ApnsPushNotification notification : notifications) {
    client.sendNotification(notification);
}

client.disconnect();

It's important to remember that clients operate asynchronously, and it's possible to enqueue notifications more quickly than they're actually sent to the server. It's possible to shut down the client before it ever has a chance to send some of the notifications, in which case notifications that haven't actually been sent to the server will fail with an Http2GoAwayException.

To avoid this situation, callers should wait for the Futures returned by ApnsClient#sendNotification to complete before disconnecting the client.