One of our Cordapps 3rd party library loads classes dynamically using following code:
ClassLoader loader = Thread.currentThread().getContextClassLoader();
return loader != null ? loader.loadClass(fullName) : Class.forName(fullName);
https://github.com/JodaOrg/joda-convert/blob/d226248e25f0b16cd7f573389e9bddf1fb4f0b47/src/main/java/org/joda/convert/StringConvert.java#L883
Normally it does not cause any issue on running flow, maybe because of following line in FlowStateMachineImpl, but I'm not sure.
|
Thread.currentThread().contextClassLoader = serviceHub.cordappProvider.appClassLoader |
Problem is that when flow is running and node is restarted, then on startup the flow is resumed and it fails with ClassNotFoundException for requested class from the cordapp - Thread.contextClassLoader does not have any of cordapp classes, only Corda classes.
Maybe when resuming the flow in such case we should set Thread.contextClassLoader as it was set originally in FlowStateMachineImpl.kt#L349 ?