java.lang.ClassCastException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • I have the expression #[payload['Id']] since I was expecting a Map. However I was wrong and instead of that I got a POJO. Instead of telling me that payload was not a map, MEL throws ClassCastException Error below: -------------------------------------------------------------------------------- Exception stack is: 1. com.sforce.soap.partner.SaveResult cannot be cast to java.lang.Class (java.lang.ClassCastException) org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer:912 (null) 2. [Error: com.sforce.soap.partner.SaveResult cannot be cast to java.lang.Class] [Near : {... payload['Id'] ....}] ^ [Line: 1, Column: 1] (org.mvel2.CompileException) org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer:435 (null) 3. Execution of the expression "payload['Id']" failed. (org.mule.api.expression.ExpressionRuntimeException) org.mule.el.mvel.MVELExpressionLanguage:208 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/expression/ExpressionRuntimeException.html) 4. Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=jdbc://updateSfdcAccountAsCompleted, connector=EEJdbcConnector { name=Database lifecycle=start this=5eb536e6 numberOfConcurrentTransactedReceivers=4 createMultipleTransactedReceivers=false connected=true supportedProtocols=[jdbc] serviceOverrides=<none> } , name='endpoint.jdbc.updateSfdcAccountAsCompleted', mep=REQUEST_RESPONSE, properties={queryTimeout=-1}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}. Message payload is of type: Arrays$ArrayList (org.mule.api.transport.DispatchException) org.mule.transport.AbstractMessageDispatcher:109 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html) -------------------------------------------------------------------------------- Root Exception stack trace: java.lang.ClassCastException: com.sforce.soap.partner.SaveResult cannot be cast to java.lang.Class at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getCollectionPropertyAO(ReflectiveAccessorOptimizer.java:912) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:380) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:143) + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything) ********************************************************************************
    via by Mariano Gonzalez,
  • I have the expression #[payload['Id']] since I was expecting a Map. However I was wrong and instead of that I got a POJO. Instead of telling me that payload was not a map, MEL throws ClassCastException Error below: -------------------------------------------------------------------------------- Exception stack is: 1. com.sforce.soap.partner.SaveResult cannot be cast to java.lang.Class (java.lang.ClassCastException) org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer:912 (null) 2. [Error: com.sforce.soap.partner.SaveResult cannot be cast to java.lang.Class] [Near : {... payload['Id'] ....}] ^ [Line: 1, Column: 1] (org.mvel2.CompileException) org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer:435 (null) 3. Execution of the expression "payload['Id']" failed. (org.mule.api.expression.ExpressionRuntimeException) org.mule.el.mvel.MVELExpressionLanguage:208 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/expression/ExpressionRuntimeException.html) 4. Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=jdbc://updateSfdcAccountAsCompleted, connector=EEJdbcConnector { name=Database lifecycle=start this=5eb536e6 numberOfConcurrentTransactedReceivers=4 createMultipleTransactedReceivers=false connected=true supportedProtocols=[jdbc] serviceOverrides=<none> } , name='endpoint.jdbc.updateSfdcAccountAsCompleted', mep=REQUEST_RESPONSE, properties={queryTimeout=-1}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}. Message payload is of type: Arrays$ArrayList (org.mule.api.transport.DispatchException) org.mule.transport.AbstractMessageDispatcher:109 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html) -------------------------------------------------------------------------------- Root Exception stack trace: java.lang.ClassCastException: com.sforce.soap.partner.SaveResult cannot be cast to java.lang.Class at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getCollectionPropertyAO(ReflectiveAccessorOptimizer.java:912) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:380) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:143) + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything) ********************************************************************************
    via by Mariano Gonzalez,
    • java.lang.ClassCastException: com.sforce.soap.partner.SaveResult cannot be cast to java.lang.Class at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getCollectionPropertyAO(ReflectiveAccessorOptimizer.java:912) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:380) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:143)
    No Bugmate found.