Hi,

I have been trying to fix this bug. I have modified the
org.apache.servicemix.camel.JbiExchange.createMessage(String name) to the
following:

private JbiMessage createMessage(String name) {
        if (messageExchange != null) {
            try {
                NormalizedMessage msg = messageExchange.getMessage(name);
                if (msg == null) {
                        if(name.equals("fault")) {
                                msg = messageExchange.createFault();
                                messageExchange.setFault((Fault) msg);
                        }
                        else {
                            msg = messageExchange.createMessage();
                            messageExchange.setMessage(msg, name);
                        }
                }
                return new JbiMessage(msg);
            } catch (JBIException e) {
                throw new RuntimeException(e);
            }
        } else {
            return new JbiMessage();
        }
    }


However, now I get the following exception when a Fault is received as a
response:

18:26:41,053 | ERROR - org.apache.camel.processor.Logger - Failed delivery
for exchangeId: ID-XXX-B624E47AF0/4562-1222189666671/0-147. On delivery
attempt: 1 caught: java.lang.IllegalStateException: component is not owner
java.lang.IllegalStateException: component is not owner
        at
org.apache.servicemix.jbi.messaging.MessageExchangeImpl.setMessage(MessageExchangeImpl.java:338)
        at
org.apache.servicemix.jbi.messaging.MessageExchangeImpl.setFault(MessageExchangeImpl.java:290)
        at
org.apache.servicemix.camel.JbiExchange.createMessage(JbiExchange.java:170)
        at
org.apache.servicemix.camel.JbiExchange.createFaultMessage(JbiExchange.java:158)
        at
org.apache.servicemix.camel.JbiExchange.createFaultMessage(JbiExchange.java:39)
        at
org.apache.camel.impl.DefaultExchange.getFault(DefaultExchange.java:251)
        at
org.apache.servicemix.camel.JbiExchange.getFault(JbiExchange.java:83)
        at
org.apache.servicemix.camel.JbiExchange.getFault(JbiExchange.java:39)
        at
org.apache.camel.impl.DefaultExchange.getFault(DefaultExchange.java:246)
        at
org.apache.servicemix.camel.JbiExchange.getFault(JbiExchange.java:78)
        at
org.apache.servicemix.camel.JbiExchange.getFault(JbiExchange.java:39)
        at
org.apache.servicemix.camel.ToJbiProcessor.process(ToJbiProcessor.java:98)
        at
org.apache.servicemix.camel.JbiEndpoint$1.process(JbiEndpoint.java:57)
        at
org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:43)
        at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:75)
        .....................


Any suggestion as to why this is happening and how can I fix this bug, which
is really blocking our development?

Thank you.



raulvk.soa wrote:
> 
> 
> Hi,
> 
> I have found the corresponding JIRA issue
> (https://issues.apache.org/activemq/browse/SM-1589), but it has minor
> priority.
> 
> Honestly, I believe that the priority of this one should be very high, as
> it is preventing Camel and ServiceMix to interact correctly. In our
> scenario, we are have come across this bug and as far as I can imagine,
> there is really no workaround to this until it is fixed!
> 
> Raul.
> 
> 
> Gert Vanthienen wrote:
>> 
>> Garry,
>> 
>> As far as I can see, you are absolutely right about this.  Could you 
>> raise a JIRA issue for it, please?  Feel free to add a unit test and a 
>> patch off course, we welcome contributions ;)!
>> 
>> Regards,
>> 
>> Gert
>> 
>> Garry wrote:
>>> Hi,
>>>
>>> While doing fault handling with Camel, I've been getting an exception:
>>>
>>>   javax.jbi.messaging.MessagingException: Setting fault, but message is
>>> not
>>> a fault
>>>   
>>> In my version of org.apache.servicemix.camel.JbiExchange, around line
>>> 153,
>>> method 'createFaultMessage' calls 'createMessage' with argument "fault."
>>> Method 'createMessage' might then create a normal - not fault - message
>>> and
>>> set it on the exchange as a FAULT which will, if I'm looking at it
>>> correctly,
>>> trigger the above exception. Does this make sense?
>>>
>>> Thanks, Garry
>>>
>>>   
>> 
>> 
>> 
>> -----
>> ---
>> Gert Vanthienen
>> http://www.anova.be
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Getting-Camel-fault-exception-tp19401580p19632981.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to