{"action":"created","issue":{"url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/issues/163","repository_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud","labels_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/issues/163/labels{/name}","comments_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/issues/163/comments","events_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/issues/163/events","html_url":"https://github.com/opentracing-contrib/java-spring-cloud/issues/163","id":336902137,"node_id":"MDU6SXNzdWUzMzY5MDIxMzc=","number":163,"title":"Sending JSON payloads using IBM MQ","user":{"login":"natami","id":612654,"node_id":"MDQ6VXNlcjYxMjY1NA==","avatar_url":"https://avatars3.githubusercontent.com/u/612654?v=4","gravatar_id":"","url":"https://api.github.com/users/natami","html_url":"https://github.com/natami","followers_url":"https://api.github.com/users/natami/followers","following_url":"https://api.github.com/users/natami/following{/other_user}","gists_url":"https://api.github.com/users/natami/gists{/gist_id}","starred_url":"https://api.github.com/users/natami/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natami/subscriptions","organizations_url":"https://api.github.com/users/natami/orgs","repos_url":"https://api.github.com/users/natami/repos","events_url":"https://api.github.com/users/natami/events{/privacy}","received_events_url":"https://api.github.com/users/natami/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-29T08:02:28Z","updated_at":"2018-06-29T09:06:33Z","closed_at":null,"author_association":"NONE","body":"How do i enable sending json formatted messages?\r\n\r\nUsing the recommended Spring Boot approach:\r\n```java \r\n    @Bean\r\n    public MessageConverter messageConverter() {\r\n        MappingJackson2MessageConverter converter = new MappingJackson2MessageConverter();\r\n        converter.setTargetType(MessageType.TEXT);\r\n        converter.setTypeIdPropertyName(\"_type\");\r\n\r\n        return converter;\r\n    }\r\n```\r\n\r\nResults in the following exception:\r\n```org.springframework.jms.listener.adapter.ListenerExecutionFailedException: Listener method 'public void com.demo.microservice.template.accountservice.account.v1_0_0.service.AccountEventSubscriber.receive(org.springframework.messaging.Message<com.demo.microservice.template.accountservice.account.v1_0_0.api.model.events.AccountEventModel>,long,java.lang.String)' threw exception; nested exception is org.springframework.jms.support.converter.MessageConversionException: Could not find type id property [_type] on message [ID:c3e2d840d4d8e3f14040404040404040d48d37eb48940284] from destination [queue:///TEST_QUEUE]\r\n\tat org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:122)\r\n\tat org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter.onMessage(MessagingMessageListenerAdapter.java:77)\r\n\tat io.opentracing.contrib.jms.spring.TracingJmsListenerEndpointRegistry$TracingMessagingMessageListenerAdapter.onMessageInternal(TracingJmsListenerEndpointRegistry.java:113)\r\n\tat io.opentracing.contrib.jms.spring.TracingJmsListenerEndpointRegistry$TracingMessagingMessageListenerAdapter.access$200(TracingJmsListenerEndpointRegistry.java:97)\r\n\tat io.opentracing.contrib.jms.spring.TracingJmsListenerEndpointRegistry$TracingMessagingMessageListenerAdapter$1.onMessage(TracingJmsListenerEndpointRegistry.java:105)\r\n\tat io.opentracing.contrib.jms.common.TracingMessageListener.onMessage(TracingMessageListener.java:41)\r\n\tat io.opentracing.contrib.jms.spring.TracingJmsListenerEndpointRegistry$TracingMessagingMessageListenerAdapter.onMessage(TracingJmsListenerEndpointRegistry.java:108)\r\n\tat org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:736)\r\n\tat org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:696)\r\n\tat org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:674)\r\n\tat org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:318)\r\n\tat org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:257)\r\n\tat org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1189)\r\n\tat org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1179)\r\n\tat org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1076)\r\n\tat java.lang.Thread.run(Thread.java:748)\r\nCaused by: org.springframework.jms.support.converter.MessageConversionException: Could not find type id property [_type] on message [ID:c3e2d840d4d8e3f14040404040404040d48d37eb48940284] from destination [queue:///TEST_QUEUE]\r\n\tat org.springframework.jms.support.converter.MappingJackson2MessageConverter.getJavaTypeForMessage(MappingJackson2MessageConverter.java:440)\r\n\tat org.springframework.jms.support.converter.MappingJackson2MessageConverter.fromMessage(MappingJackson2MessageConverter.java:230)\r\n\tat org.springframework.jms.listener.adapter.AbstractAdaptableMessageListener.extractMessage(AbstractAdaptableMessageListener.java:251)\r\n\tat org.springframework.jms.listener.adapter.AbstractAdaptableMessageListener$MessagingMessageConverterAdapter.extractPayload(AbstractAdaptableMessageListener.java:476)\r\n\tat org.springframework.jms.listener.adapter.AbstractAdaptableMessageListener$MessagingMessageConverterAdapter$LazyResolutionMessage.unwrapPayload(AbstractAdaptableMessageListener.java:542)\r\n\tat org.springframework.jms.listener.adapter.AbstractAdaptableMessageListener$MessagingMessageConverterAdapter$LazyResolutionMessage.getPayload(AbstractAdaptableMessageListener.java:525)\r\n\tat org.springframework.messaging.handler.annotation.support.MessageMethodArgumentResolver.resolveArgument(MessageMethodArgumentResolver.java:82)\r\n\tat org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:116)\r\n\tat org.springframework.messaging.handler.invocation.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:137)\r\n\tat org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:109)\r\n\tat org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:114)\r\n\t... 15 common frames omitted\r\n\r\n2018-06-29 09:58:18.184  WARN 15100 --- [enerContainer-1] o.s.j.l.DefaultMessageListenerContainer  : Execution of JMS message listener failed, and no ErrorHandler has been set.\r\n\r\ncom.ibm.msg.client.wmq.compat.jms.internal.ConfigEnvironment$MyJMSException: MQJMS1075: Error writing dead letter header.\r\n\tat com.ibm.msg.client.wmq.compat.jms.internal.ConfigEnvironment.newException(ConfigEnvironment.java:373)\r\n\tat com.ibm.msg.client.wmq.compat.jms.internal.DLH.write(DLH.java:489)\r\n\tat com.ibm.msg.client.wmq.compat.jms.internal.MQMessageConsumer.deadLetter(MQMessageConsumer.java:1812)\r\n\tat com.ibm.msg.client.wmq.compat.jms.internal.MQMessageConsumer.removeBadMessage(MQMessageConsumer.java:4704)\r\n\tat com.ibm.msg.client.wmq.compat.jms.internal.MQMessageConsumer.getMessage(MQMessageConsumer.java:2925)\r\n\tat com.ibm.msg.client.wmq.compat.jms.internal.MQMessageConsumer.receiveInternal(MQMessageConsumer.java:4622)\r\n\tat com.ibm.msg.client.wmq.compat.jms.internal.MQMessageConsumer.receive(MQMessageConsumer.java:4105)\r\n\tat com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl.receiveInboundMessage(JmsMessageConsumerImpl.java:1073)\r\n\tat com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl.receive(JmsMessageConsumerImpl.java:691)\r\n\tat com.ibm.mq.jms.MQMessageConsumer.receive(MQMessageConsumer.java:209)\r\n\tat org.springframework.jms.support.destination.JmsDestinationAccessor.receiveFromConsumer(JmsDestinationAccessor.java:132)\r\n\tat org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveMessage(AbstractPollingMessageListenerContainer.java:418)\r\n\tat org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:303)\r\n\tat org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:257)\r\n\tat org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1189)\r\n\tat org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1179)\r\n\tat org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1076)\r\n\tat java.lang.Thread.run(Thread.java:748)\r\nCaused by: java.nio.charset.UnmappableCharacterException: Input length = 1\r\n\tat java.nio.charset.CoderResult.throwException(CoderResult.java:282)\r\n\tat sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:285)\r\n\tat sun.nio.cs.StreamEncoder.write(StreamEncoder.java:125)\r\n\tat sun.nio.cs.StreamEncoder.write(StreamEncoder.java:135)\r\n\tat java.io.OutputStreamWriter.write(OutputStreamWriter.java:220)\r\n\tat com.ibm.msg.client.wmq.compat.base.internal.MQMessage.writeString(MQMessage.java:1257)\r\n\tat com.ibm.msg.client.wmq.compat.jms.internal.DLH.writeDLHFields(DLH.java:544)\r\n\tat com.ibm.msg.client.wmq.compat.jms.internal.DLH.write(DLH.java:476)\r\n\t... 16 common frames omitted\r\n```\r\n\r\nSending the object as a Serializable works without problems.\r\n\r\nOr enabling the previously mentioned MessageConverter and disabling opentracing-spring-cloud-starter then Json payloads works."},"comment":{"url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/issues/comments/401295977","html_url":"https://github.com/opentracing-contrib/java-spring-cloud/issues/163#issuecomment-401295977","issue_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/issues/163","id":401295977,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMTI5NTk3Nw==","user":{"login":"natami","id":612654,"node_id":"MDQ6VXNlcjYxMjY1NA==","avatar_url":"https://avatars3.githubusercontent.com/u/612654?v=4","gravatar_id":"","url":"https://api.github.com/users/natami","html_url":"https://github.com/natami","followers_url":"https://api.github.com/users/natami/followers","following_url":"https://api.github.com/users/natami/following{/other_user}","gists_url":"https://api.github.com/users/natami/gists{/gist_id}","starred_url":"https://api.github.com/users/natami/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natami/subscriptions","organizations_url":"https://api.github.com/users/natami/orgs","repos_url":"https://api.github.com/users/natami/repos","events_url":"https://api.github.com/users/natami/events{/privacy}","received_events_url":"https://api.github.com/users/natami/received_events","type":"User","site_admin":false},"created_at":"2018-06-29T09:06:33Z","updated_at":"2018-06-29T09:06:33Z","author_association":"NONE","body":"Yes, adding opentracing-spring-cloud-starter dependency introduces the error.\r\n\r\nI can make a simple example - although I don't have access to any ActiveMQ setup to test this on. Suppose you could change the IBM MQ parts to ActiveMQ yourself (No code, pure spring config)?\r\n\r\nI'll get back to you asap with an example."}}
{"actor":{"display_login":"natami"}}