title: Solution for the ClassCastException due to ClassLoader issue
body: <p>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. </p>
  
  <p>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. </p>
  
  <p>But the issue is that the returned object's type is <code>Object</code>. So, I have to cast down that object to access some methods. How can I do that? Normal cast like the following causes ClassCastException, which I already know.</p>
  
  <pre><code>Mojo mojo = (Mojo) descriptor.getMojo();
  </code></pre>
  
  <p><code>descriptor#getMojo()</code> returns an object of type <code>Mojo</code> but the method returns <code>Object</code>. How can do this? </p>
  
  <p>Let me know if you need further info. </p>
  
  <p>I've read all the theories about classloading, but none has specified a proper solution for this.</p>