You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "einsitang (via GitHub)" <gi...@apache.org> on 2023/05/25 19:18:55 UTC

[GitHub] [rocketmq-spring] einsitang commented on issue #561: onMessage ClassCastException in abstract class implements RocketMQListener

einsitang commented on issue #561:
URL: https://github.com/apache/rocketmq-spring/issues/561#issuecomment-1563394999

   你的问题应该就是`doConvertMessage(messageExt)`没有找到正确的反序列化方法,所以识别成LinkHashMap,之后调用你的`BaseStringMQListener.onMessage` 方法,所以就报转换错误
   ```
   java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to java.lang.String
   at com.evatmaster.biz.center.order.listener.BaseStringMQListener.onMessage(BaseStringMQListener.java:9)
   ```
   你的message信息是:{"orderId":1659164170366488577,"systemType":"00"}
   发送的时候明确转换成json string则应该是:"{\"orderId\":1659164170366488577,\"systemType\":\"00\"}"
   那么他就可以识别了。
   
   不过奇怪的是,为什么行号是错误的 `BaseStringMQListener.java:9`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org