Uploaded image for project: 'FUSE Mediation Router'
  1. FUSE Mediation Router
  2. MR-220

Can't send an ObjectMessage through Camel containing a serialized object unless Camel has access to the Java class.

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • 1.6.1.2-fuse
    • 1.6.1.0-fuse
    • None
    • None

      The use case is to have Camel route messages between JMS queues. The messages themselves are JMS ObjectMessage which contain serialized Java objects. If Camel receives one of these it will try and instantiate the object in which case an error is thrown:

      org.apache.camel.component.jms.RuntimeJmsException: Failed to extract body due to:
       javax.jms.JMSException: Failed to build body from content. Serializable class not available to broker. Reason: 
      java.lang.ClassNotFoundException: org.someclass.that.im.Sending
      

      Looking at JmsConfiguration and the docs it appears you can configure Camel to use a custom Spring MessageConverter so I tried this (the attached test case) and while my MessageConverter is instantiated it's never actually used, so the outcome of my test route is the actual type and not a JMSMessage or ObjectMessage like I'd want. Seems like JmsBinding should be using the MessageConverter instead of what it's doing in extractBodyFromJms() where it directly tests for each type of message, I believe this is where the above exception is actually coming from.

            cibsen@redhat.com Claus Ibsen
            stlewis_2 Stan Lewis
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: