See jnr/jnr-ffi#51 for the issue.
This could be fixed in the library using something like:
/**
* Workaround for unfortunate system class loader usage.
*
* @see https://github.com/jnr/jnr-ffi/issues/51
*/
@SneakyThrows
private void patchFfi() {
ClosureManager closureManager = NativeRuntime.getInstance().getClosureManager();
// Get inner class loader
val classLoader = findField(closureManager.getClass(), "classLoader");
classLoader.setAccessible(true);
val asmClassLoader = classLoader.get(closureManager);
// Update to use context class loader over the default system class loader
val parent = findField(asmClassLoader.getClass(), "parent");
parent.setAccessible(true);
parent.set(asmClassLoader, Thread.currentThread().getContextClassLoader());
}
Thoughts?
See jnr/jnr-ffi#51 for the issue.
This could be fixed in the library using something like:
Thoughts?