java.lang.ClassCastException: null error in mendix 7.23.5

0
Hi All, I am trying to consume sap Odata in mendix application where the microflow client action throws java.lang.ClassCastException: null error . While debugging the microflow, able to see all actions are getting executed without any errors and values are getting posted but still while loading the page in the browser, web page shows “An error occured contact your administrator” and  Console shows “java.lang.ClassCastException: null”  Same microflow is working fine without any interruptions in 7.13.1  As i understood from this https://community.mendix.com/link/questions/88707  question in the forum, deserializing the state from the database to Mendix objects for background jobs, date values are parsed to an Integer instead of a Long. We were getting java.lang.lng cannot be cast to java.math.BigDecimal exception intially. Tried with other versions of modeler also like 7.23.3 and 7.18 Kindly let me  know the ways to get over this.  
asked
1 answers
0

The exaception thrown to indicate that your code has attempted to cast an object to a subclass of which it is not an instance. This means that ClassCastException occurs when you try to cast an instance of an Object to a type that it is not. Type Casting 5 only works when the casted object follows an is a relationship to the type you are trying to cast to.

It is good practice to guard any explicit casts with an instanceof check first:

if (myApple instanceof Fruit) {
  Fruit myFruit = (Fruit)myApple;
}

When will be ClassCastException is thrown:

  • When you try to cast an object of Parent class to its Child class type, this exception will be thrown.
  • When you try to cast an object of one class into another class type that has not extended the other class or they don’t have any relationship between them.

 

answered