I have two ClassLoaders which loads the same class. So, obviously these can't cast to one another. But I need to access an object created in the other ClassLoader.
I have access to both ClassLoaders. How can I use that object in the other class? I don't need to cast the object to match to the current ClassLoader.
But the issue is that the returned object's type is
Mojo mojo = (Mojo) descriptor.getMojo();
AFAIK, no, you can't cast an object of a class loaded by one class-loader in another class loader.