I have two ClassLoaders that load the same class. Thus, it is obvious that they cannot abandon each other. But I need to access an object created in another ClassLoader.
I have access to ClassLoaders. How can I use this object in another class? I do not need to throw the object in line with the current ClassLoader.
But the problem is that the return type is Object . So, I have to drop this object in order to access some methods. How can i do this? A normal action like the one below throws a ClassCastException, which I already know about.
Mojo mojo = (Mojo) descriptor.getMojo();
descriptor#getMojo() returns an object of type Mojo , but the method returns Object . How can I do that?
Let me know if you need more information.
I read all theories about loading classes, but none of them indicated the correct solution for this.
source share