Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-5872

Unable to send JSON/Object to activemq in Camel

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Critical
    • jboss-fuse-6.3
    • jboss-fuse-6.3
    • Camel
    • % %
    • Hide

      1. Start standalone Fuse 6.3.0-133
      2. features:install camel-jms camel-jackson activemq-camel
      3. Change version of Fuse to desired version and build provided reproducer: mvn clean install
      4. osgi:install -s mvn:org.jboss.fuse.qa.fabric/xlate-customer/1.0
      5. Send message to testIn (via Hawtio for example):

      {"name":"7adbere9cm8a7ckttcv6i3f5tj","surname":"2bb3uf381m7jpltg2f4ogd05eg","dateOfBirth":"n9inuc5gkujtv7btm7o5j8hbh","numberOfIdentification":"7abie87tk0aptpca6o56509kru","id":"228i69913ff69q1c8kdursbdep","procedure":{"medicalFacility":{"name":"36gakmlr4htlpjk6031jbcscte","address":{"address":"44bgpor6n7f3ji4528h75oir7e","city":"p37g4ni2bbh7att5sq38bbs9n","country":"4l3rucgm6p99d136n5b1ha398l","postalCode":"1ur04r5opnac6dofnm89u8vrho"},"facilityType":"SUPER_HOSPITAL"},"procedureType":"PRESSURE","additionalNotes":"2jgm02m496d2ochlddfk3rp7n9"},"address":{"address":"3laq39qaml6o7r5vqhb28b7spt","city":"22fliedrf9pr9ednb5t8tv41ij","country":"2328tb581mh4v9uh45hrrvqd4l","postalCode":"7ule30q42qt5ss4b2dnp6v7ru"}}
      
      Show
      1. Start standalone Fuse 6.3.0-133 2. features:install camel-jms camel-jackson activemq-camel 3. Change version of Fuse to desired version and build provided reproducer: mvn clean install 4. osgi:install -s mvn:org.jboss.fuse.qa.fabric/xlate-customer/1.0 5. Send message to testIn (via Hawtio for example): { "name" : "7adbere9cm8a7ckttcv6i3f5tj" , "surname" : "2bb3uf381m7jpltg2f4ogd05eg" , "dateOfBirth" : "n9inuc5gkujtv7btm7o5j8hbh" , "numberOfIdentification" : "7abie87tk0aptpca6o56509kru" , "id" : "228i69913ff69q1c8kdursbdep" , "procedure" :{ "medicalFacility" :{ "name" : "36gakmlr4htlpjk6031jbcscte" , "address" :{ "address" : "44bgpor6n7f3ji4528h75oir7e" , "city" : "p37g4ni2bbh7att5sq38bbs9n" , "country" : "4l3rucgm6p99d136n5b1ha398l" , "postalCode" : "1ur04r5opnac6dofnm89u8vrho" }, "facilityType" : "SUPER_HOSPITAL" }, "procedureType" : "PRESSURE" , "additionalNotes" : "2jgm02m496d2ochlddfk3rp7n9" }, "address" :{ "address" : "3laq39qaml6o7r5vqhb28b7spt" , "city" : "22fliedrf9pr9ednb5t8tv41ij" , "country" : "2328tb581mh4v9uh45hrrvqd4l" , "postalCode" : "7ule30q42qt5ss4b2dnp6v7ru" }}
    • Sprint 6 - towards CR1

    Description

      It seems there is some regression in Fuse 6.3 when sending JSON or Custom Object to activemq queue/topic using Camel.

      Here is simplified reproducer route for this problem:

      <bean id="transform" class="org.jboss.fuse.qa.xxx.usecase.translate.TransformCustomer"/>
      
      	<camelContext id="xlate-customer" xmlns="http://camel.apache.org/schema/blueprint" autoStartup="true">
      		<propertyPlaceholder location="blueprint:placeholder1,blueprint:placeholder2,blueprint:placeholder3,blueprint:placeholder4" id="properties1"/>
      		<dataFormats>
      			<json id="customer" library="Jackson" unmarshalTypeName="org.jboss.fuse.qa.xxx.usecase.customer.Customer"/>
      			<json id="insuranceCustomer" library="Jackson" unmarshalTypeName="org.jboss.fuse.qa.xxx.usecase.insurance.InsuranceCustomer"/>
      
      		</dataFormats>
      		<route id="xlate2">
      			<from uri="activemq-out:queue:testIn?username=admin&amp;password=admin&amp;destination.consumer.exclusive=true"/>
      			<unmarshal ref="customer"/>
      			<bean ref="transform"/>
      			<marshal ref="insuranceCustomer"/>
      			<to uri="activemq-out:queue:testOut?username=admin&amp;password=admin&amp;disableReplyTo=true"/>
      		</route>
      
      	</camelContext>
      

      Using this route and sending correct JSON string to first queue generates this Exception in Fuse 6.3.0 133:

      2016-07-19 15:16:03,438 | ERROR | Consumer[testIn] | DefaultErrorHandler              | 231 - org.apache.camel.camel-core - 2.17.0.redhat-630133 | Failed delivery for (MessageId: ID-rjakubco-ThinkPad-T460s-38402-1468934125979-0-2 on ExchangeId: ID-rjakubco-ThinkPad-T460s-38402-1468934125979-0-1). Exhausted after delivery attempt: 1 caught: java.lang.NullPointerException
      
      Message History
      ---------------------------------------------------------------------------------------------------------------------------------------
      RouteId              ProcessorId          Processor                                                                        Elapsed (ms)
      [xlate2            ] [xlate2            ] [activemq-out://queue:testIn?destination.consumer.exclusive=true&password=xxxxx] [        81]
      [xlate2            ] [unmarshal1        ] [unmarshal[ref:customer]                                                       ] [        56]
      [xlate2            ] [bean1             ] [bean[ref:transform]                                                           ] [         1]
      [xlate2            ] [marshal1          ] [marshal[ref:insuranceCustomer]                                                ] [        14]
      [xlate2            ] [to1               ] [activemq-out:queue:testOut?username=admin&password=xxxxxx&disableReplyTo=true ] [         6]
      
      Stacktrace
      ---------------------------------------------------------------------------------------------------------------------------------------
      java.lang.NullPointerException
      	at org.apache.activemq.camel.component.OriginalDestinationPropagateStrategy.onMessageCreated(OriginalDestinationPropagateStrategy.java:45)[245:org.apache.activemq.activemq-camel:5.11.0.redhat-630133]
      	at org.apache.camel.component.jms.JmsBinding.makeJmsMessage(JmsBinding.java:309)[243:org.apache.camel.camel-jms:2.17.0.redhat-630133]
      	at org.apache.camel.component.jms.JmsProducer$2.createMessage(JmsProducer.java:301)[243:org.apache.camel.camel-jms:2.17.0.redhat-630133]
      	at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.doSendToDestination(JmsConfiguration.java:498)[243:org.apache.camel.camel-jms:2.17.0.redhat-630133]
      	at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.access$100(JmsConfiguration.java:441)[243:org.apache.camel.camel-jms:2.17.0.redhat-630133]
      	at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate$1.doInJms(JmsConfiguration.java:455)[243:org.apache.camel.camel-jms:2.17.0.redhat-630133]
      	at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:466)[242:org.apache.servicemix.bundles.spring-jms:3.2.16.RELEASE_1]
      	at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:452)[243:org.apache.camel.camel-jms:2.17.0.redhat-630133]
      	at org.apache.camel.component.jms.JmsProducer.doSend(JmsProducer.java:414)[243:org.apache.camel.camel-jms:2.17.0.redhat-630133]
      	at org.apache.camel.component.jms.JmsProducer.processInOnly(JmsProducer.java:368)[243:org.apache.camel.camel-jms:2.17.0.redhat-630133]
      	at org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:154)[243:org.apache.camel.camel-jms:2.17.0.redhat-630133]
      	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)[231:org.apache.camel.camel-core:2.17.0.redhat-630133]
      	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[231:org.apache.camel.camel-core:2.17.0.redhat-630133]
      	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:468)[231:org.apache.camel.camel-core:2.17.0.redhat-630133]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)[231:org.apache.camel.camel-core:2.17.0.redhat-630133]
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)[231:org.apache.camel.camel-core:2.17.0.redhat-630133]
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)[231:org.apache.camel.camel-core:2.17.0.redhat-630133]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)[231:org.apache.camel.camel-core:2.17.0.redhat-630133]
      	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)[231:org.apache.camel.camel-core:2.17.0.redhat-630133]
      	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:91)[231:org.apache.camel.camel-core:2.17.0.redhat-630133]
      	at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:112)[243:org.apache.camel.camel-jms:2.17.0.redhat-630133]
      	at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:555)[242:org.apache.servicemix.bundles.spring-jms:3.2.16.RELEASE_1]
      	at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:515)[242:org.apache.servicemix.bundles.spring-jms:3.2.16.RELEASE_1]
      	at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:485)[242:org.apache.servicemix.bundles.spring-jms:3.2.16.RELEASE_1]
      	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)[242:org.apache.servicemix.bundles.spring-jms:3.2.16.RELEASE_1]
      	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:263)[242:org.apache.servicemix.bundles.spring-jms:3.2.16.RELEASE_1]
      	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1103)[242:org.apache.servicemix.bundles.spring-jms:3.2.16.RELEASE_1]
      	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1095)[242:org.apache.servicemix.bundles.spring-jms:3.2.16.RELEASE_1]
      	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:992)[242:org.apache.servicemix.bundles.spring-jms:3.2.16.RELEASE_1]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_91]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_91]
      	at java.lang.Thread.run(Thread.java:745)[:1.8.0_91]
      

      The same problem occurs when the marshalling is skipped and a custom Object is sent to the testOut queue. Using the same Camel route in Fuse 6.2.1 117 works without a problem(same for Object).

      Also I would like to note that if you add <convertBodyTo type="java.lang.String"/> after marshall element then the message is delivered without a problem.

      Attachments

        Activity

          People

            acosenti Andrea Cosentino
            rjakubco Roman Jakubco (Inactive)
            Roman Jakubco Roman Jakubco (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: