Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-dev] Jetty 10 with ALPN / H2 on the class path

> JDK9ServerALPNProcessor is on my classpath but I'm not running Jetty on the module path, so no dice..

Ehm, what? The sentence above does not compute for me.

Sorry for being unclear.

I'm running Jetty from within a Java agent. To avoid class loading conflicts with applications (which may also be running Jetty), the agent only has a very minimal main class which sets up a URLClassLoader with a classpath from subdirectories "hidden" under META-INF/dependencies.

This way, the class loader hierarchy looks like this:

Bootstrap
  Platform
    App <- This is the default Thread context classloader
      Custom URLClassLoader <- Jetty lives here

So when Jetty tries to load services, ServiceLoader looks in the App class loader, which does not see Jetty at all.

If Jetty had done this:

ServiceLoader.load(Server.class, Server.class.getClassLoader())

Instead of this:

ServiceLoader.load(Server.class)

Then I think things would just work out of the box, without having to call Thread.currentThread().setContextClassLoader() first.

Eirik.
         

Back to the top