I'm trying to use CompletableFuture with EBJ bean running on WildFly.
I can see the debugger reach the remote Ejb and retrieve the result successfully but in the Wayback to caller class I got an exception
java.lang.ClassNotFoundException: No classloader available
CompletableFuture<Void> future = CompletableFuture.supplyAsync(() -> {
dnsRecords = ipaFacadeService.fetchDnsRecords();
return dnsRecords;
}).thenAccept(result -> {
if (result.size() > 0) {
//do more stuff with the result
}
});
future.get();
When I stack trace the exception I found it is related to ForkJoin which is used by CompletableFuture.supplyAsync()
[org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:238),
org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:183),
org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:146),
com.sun.proxy.$Proxy107.fetchDnsRecords(Unknown Source), no.lyse.tele.prov.struts2.action.network.DnsAction.lambda$list$1(DnsAction.java:150),
java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590),
java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1582),
java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289),
java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056),
java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692),
java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)]
caused by
stack – Torpedo