spring-integration: ClassCastException after upgrade to Spring Boot 2.5-RC1
In what version(s) of Spring Integration are you seeing this issue?
5.5.0-RC1 via Spring Boot 2.5-RC1
Describe the bug
java.lang.ClassCastException: java.lang.String cannot be cast to org.springframework.messaging.Message
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_292]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_292]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_292]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_292]
at org.springframework.integration.handler.LambdaMessageProcessor.processMessage(LambdaMessageProcessor.java:97) ~[spring-integration-core-5.5.0-RC1.jar:5.5.0-RC1]
at org.springframework.integration.handler.ServiceActivatingHandler.handleRequestMessage(ServiceActivatingHandler.java:105) [spring-integration-core-5.5.0-RC1.jar:5.5.0-RC1]
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:134) [spring-integration-core-5.5.0-RC1.jar:5.5.0-RC1]
on handler method within integration flow.
Sample
https://github.com/agebhar1/spring-integration-kotlin-bug
The error does not occur if explicitly use Koltin 1.4(.32)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 26 (26 by maintainers)
Commits related to this issue
- GH-3558: Kotlin DSL: propagate generics info Fixes https://github.com/spring-projects/spring-integration/issues/3558 Kotlin lambdas mostly used to configure endpoints in DSL manner are not really Ja... — committed to artembilan/spring-integration by artembilan 3 years ago
- GH-3558: Kotlin DSL: propagate generics info (#3561) Fixes https://github.com/spring-projects/spring-integration/issues/3558 Kotlin lambdas mostly used to configure endpoints in DSL manner are no... — committed to spring-projects/spring-integration by artembilan 3 years ago
- GH-3558: Kotlin DSL: propagate generics info (#3561) Fixes https://github.com/spring-projects/spring-integration/issues/3558 Kotlin lambdas mostly used to configure endpoints in DSL manner are no... — committed to spring-projects/spring-integration by artembilan 3 years ago
- GH-3558: Kotlin DSL: propagate generics info (#3561) Fixes https://github.com/spring-projects/spring-integration/issues/3558 Kotlin lambdas mostly used to configure endpoints in DSL manner are no... — committed to spring-projects/spring-integration by artembilan 3 years ago
See related PR: https://github.com/spring-projects/spring-integration/pull/3561
And this one indeed a problem. We need to figure out what to do with that… Looks like we can’t figure out an input type and fallback to regular
payloadpropagation.It fails even with current Kotlin
1.4.xsupport:Thank you for your persistence!
Reopening…
Unfortunately with the Kotlin DSL this flow also raise an
ClassCastException:Thanks for confirmation!
I don’t think there is needed some hint, since we have that doc already pointing for the reason of such a
ClassCastException. Plus, it is indeed recommended to use an idiomatic Kotlin DSL instead. 😄