Hey everyone, I'm stumped on why this is happening, so hoping you all can help out. I have two different applications set up using SI and RabbitMQ to send messages along a pipeline. I have an object that gets turned into json using the object-to-json transformer. The messages go into the queue and the next application picks them up and then the object-to-json transformer pukes and can't transform the object. It says the object is a byte array ([B), but in the logging, it is clearly a string even with a content type of application/json. So I don't get what is happening. Here is the stack trace:
Here is the spring config for the receiving end of the application:Code:WARN : SimpleAsyncTaskExecutor-1 org.springframework.amqp.rabbit.config.StatelessRetryOperationsInterceptorFactoryBean - Message dropped on recovery: (Body:'{"id":null,"source":"USER","details":"test ","summary":null,"title":"Test","effectiveDate":1359010800000,"expirationDate":1359097200000,"messageType":"ALERT","messageStatus":null,"messageUrgency":null,"messageSeverity":null,"messageCertainty":null,"areas":[ ... ],"sourceId":null,"alertType":"User Generated"}'; ID:null; Content:application/json; Headers:{content-type=application/json}; Exchange:; RoutingKey:messages; Reply:null; DeliveryMode:PERSISTENT; DeliveryTag:1) org.springframework.amqp.rabbit.listener.ListenerExecutionFailedException: Listener threw exception at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.wrapToListenerExecutionFailedExceptionIfNeeded(AbstractMessageListenerContainer.java:647) at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:586) at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:482) at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$001(SimpleMessageListenerContainer.java:58) at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$1.invokeListener(SimpleMessageListenerContainer.java:107) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.retry.interceptor.RetryOperationsInterceptor$1.doWithRetry(RetryOperationsInterceptor.java:69) at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:255) at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:162) at org.springframework.retry.interceptor.RetryOperationsInterceptor.invoke(RetryOperationsInterceptor.java:87) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at $Proxy12.invokeListener(Unknown Source) at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.invokeListener(SimpleMessageListenerContainer.java:608) at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:454) at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:471) at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:455) at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$300(SimpleMessageListenerContainer.java:58) at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:548) at java.lang.Thread.run(Thread.java:662) Caused by: org.springframework.integration.transformer.MessageTransformationException: failed to transform message at org.springframework.integration.transformer.AbstractTransformer.transform(AbstractTransformer.java:44) at org.springframework.integration.transformer.MessageTransformingHandler.handleRequestMessage(MessageTransformingHandler.java:67) at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:134) at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73) at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:115) at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:102) at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77) at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:157) at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:128) at org.springframework.integration.core.MessagingTemplate.doSend(MessagingTemplate.java:288) at org.springframework.integration.core.MessagingTemplate.send(MessagingTemplate.java:149) at org.springframework.integration.endpoint.MessageProducerSupport.sendMessage(MessageProducerSupport.java:92) at org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter.access$200(AmqpInboundChannelAdapter.java:41) at org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter$1.onMessage(AmqpInboundChannelAdapter.java:76) at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:584) ... 24 more Caused by: java.lang.ClassCastException: [B cannot be cast to java.lang.String at org.springframework.integration.json.JsonToObjectTransformer.transformPayload(JsonToObjectTransformer.java:30) at org.springframework.integration.transformer.AbstractPayloadTransformer.doTransform(AbstractPayloadTransformer.java:33) at org.springframework.integration.transformer.AbstractTransformer.transform(AbstractTransformer.java:33) ... 38 more
I'm using Spring Integration 2.2.0.RELEASE. Funny thing is this all used to work. I think I might have upgraded to 2.2 at some point and they may have been when it broke...but I'm not sure...Code:<context:annotation-config /> <mvc:annotation-driven/> <si:logging-channel-adapter id="logger" level="DEBUG"/> <!-- All the messages come from the Messages rabbit queue --> <rabbit:queue name="messages"/> <amqp:inbound-channel-adapter channel="messagesIn" connection-factory="rabbitConnectionFactory" queue-names="messages" advice-chain="retryInterceptor" /> <si:channel id="messageChannel"> <si:interceptors> <si:wire-tap channel="logger"/> </si:interceptors> </si:channel> <si:json-to-object-transformer input-channel="messagesIn" output-channel="messageChannel" type="com.mycompany.model.Message"/> <bean id="messageHandler" class="com.mycompany.MessageConsumer"/> <si:service-activator input-channel="messageChannel" ref="messageHandler"/>
Please help! Thanks!


Reply With Quote
