Skip to content

Commit

Permalink
fix: make SystemClassLoader available to Infinispan
Browse files Browse the repository at this point in the history
When Infinispan is initialized it is using the ContextClassLoader of the current Thread to resolve resources. The ContextClassLoader of a Vert.x event loop is initially null, which causes Infinispan to fail.
  • Loading branch information
pk-work committed Oct 11, 2022
1 parent 5d3999b commit d8b9b1f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/io/neonbee/cluster/ClusterManagerFactory.java
Expand Up @@ -3,6 +3,7 @@
import static com.google.common.base.Strings.isNullOrEmpty;
import static io.vertx.core.Future.failedFuture;
import static io.vertx.core.Future.succeededFuture;
import static java.lang.ClassLoader.getSystemClassLoader;

import java.io.IOException;

Expand Down Expand Up @@ -48,6 +49,7 @@ public Future<ClusterManager> create(NeonBeeOptions neonBeeOptions) {
String effectiveConfig = getEffectiveConfig(neonBeeOptions);

try {
Thread.currentThread().setContextClassLoader(getSystemClassLoader());
return succeededFuture(new InfinispanClusterManager(new DefaultCacheManager(effectiveConfig, true)));
} catch (IOException e) {
return failedFuture(e);
Expand Down

0 comments on commit d8b9b1f

Please sign in to comment.