[rabbitmq-discuss] Response message ClassCastException: Cannot cast java.util.LinkedHashMap (id=173) to com.sw.Employee

Rajasekhar P sekhar434145 at gmail.com
Wed May 14 07:52:29 BST 2014


Hi Team,

Am getting cannot cast exception in Listener when I am trying to send
LinkedHashMap as request at producer end using Spring AMQP.

Request -
Map<String, Object> reqMap = new LinkedHashMap<String, Object>();
Employee emp = new Employee();
reqMap.put("empObj", emp);
reqMap.put("comp", "XYZ");
template.convertAndSend(reqMap);

Respons-
void handleMessage(Map myReqMsg){
 Employee emp = (Employee)  myReqMsg.get("empObj");
}

Exception at Consumer End :-
ClassCastException: Cannot cast java.util.LinkedHashMap (id=173) to
com.sw.Employee

Thanks,
Sekhar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140514/d1fefdcc/attachment.html>


More information about the rabbitmq-discuss mailing list