Here is the simplified version of the problem:
SomeClass c = (SomeClass) obj.getSomeClassParent()
not always but it happens sometimes to t
Strange have you tried casting it to a Object it extends, not sure if it has the functionality you require but might be worth trying to see if it still throws the exception.