javainfinispanqpid

Conflict when both infinispan and qpid-broker registers URLStreamHandlers


I'm trying to upgrade infinispan from version 9 to 13 in our application. Since version 12.1, infinispan has a ClasspathURLStreamHandler that automatically registers itself (on Java >= 9).

This causes issues as our application also uses qpid-broker, and that library also has a URLStreamHandler that automatically registers itself.

Now, I don't fully understand how URL.setURLStreamHandlerFactory works - but my understanding of the problem is:

  1. Both infinispan and qpid-broker tries to register their respective URLStreamHandler, for the classpath protocol
  2. Only one URLStreamHandler can be registered. In this case infinispan happens to be first, and its handler is registered.
  3. When starting up qpid-broker, it tries to read system.properties using an URL classpath:system.properties (this happens in org.apache.qpid.server.SystemLauncher).
  4. There is no system.properties on the classpath (I think) - and infinispan's handler returns null, resulting in a NullPointerException in qpid-broker.

Note that the behavior of infinispan's handler is different compared to the behaviour of qpid-broker's handler, which throws an exception on failure (e.g. FileNotFoundException or MalformedURLException) instead of returning null.

Questions:


Solution

  • You are right, the behaviour is wrong. I've created an issue https://issues.redhat.com/browse/ISPN-14732 and it will be incorporated in 14.0.8.Final.