2

I am trying to get the Class type received in a response and suddenly I get this exception:

java.lang.ClassCastException: com.myweb.process.api.util.MyProcessModel 
cannot be cast to com.myweb.process.api.util.MyProcessModel

How is this possible?

Would this have something to do with the Classpath?

The code I am running is:

List<Object> responses = context.getResponses();
for (Object response : responses) {
   if (response instanceof MyProcessModel) {
      MyProcessModel model = (MyProcessModel) response;
      // Process...
   }
}

First, the instanceof is always false and if I try to cast the value it goes the exception above.

Joe Almore
  • 4,036
  • 9
  • 52
  • 77

0 Answers0