You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Gert Vanthienen <ge...@skynet.be> on 2008/08/31 13:08:47 UTC

Re: ERROR - BeanComponent - Error setting exchange status to ERROR

Adrian,

I think the problem is in your bean SU code.  If the endpoint is 
endpoint1 or endpoint2, you are sending the exchange with the status set 
to ERROR.  Right after that, you try to set the exchange status to 
DONE.  However, you can not do that to an exchange you already sent 
before -- hence the exception when you call th setStatus() method. 

You probably want to add an 'else' to your code, only setting the 
exchange status to DONE if it hasn't ended in error.

Regards,

Gert



Adrian Plunkett wrote:
> Hi,
>
> I have a flow CXFBC -> CXFSE -> JMS -> CAMEL -> BEAN.
>
> The bean maintains a connection to an external network service.
> The camel component load balances over several instances of the bean.
> The jms component decouples the front-end web service interface from 
> the beans.
> The cxf components provide a web-service interface.
>
> This is implemented in Servicemix 3.2.2 running on OS/X.
>
> If my bean experiences a problem (ie network disconnect from remote 
> server), the message exchange should fail and the message returned to 
> the jms queue.
> This is working as expected, but more by chance than design.
>
> An extract of the servicemix log is supplied below:
>
> DEBUG - BeanComponent                  - Received exchange: status: 
> Active, role: provider
> DEBUG - BeanComponent                  - Retrieved correlation id: null
> INFO  - SmppClient                     - message received by: smpp1
> DEBUG - DeliveryChannelImpl            - Send 
> ID:10.0.1.197-11c1754de9f-17:2 in DeliveryChannel{servicemix-bean}
> DEBUG - SecuredBroker                  - send exchange with secure broker
> DEBUG - SedaFlow                       - Called Flow send
> INFO  - SmppClient                     - From number: 61400033655
> INFO  - SmppClient                     - To number: 61400033655
> INFO  - SmppClient                     - Message: 
> org.apache.servicemix.jbi.messaging.NormalizedMessageImpl@64dcc{properties: 
> {message=test message, toNumber=61400033655, fromNumber=61400033655}}
> ERROR - BeanComponent                  - Error processing exchange 
> InOnly[
>   id: ID:10.0.1.197-11c1754de9f-17:2
>   status: Error
>   role: provider
>   endpoint: smpp1
>   in: null
>   error: java.lang.Exception: big bad exception occured
> ]
> java.lang.IllegalStateException: component is not owner
>     at 
> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.setStatus(MessageExchangeImpl.java:251) 
>
>     at 
> au.com.sensis.voice.sms.SmppClient.onMessageExchange(SmppClient.java:296)
>     at 
> org.apache.servicemix.bean.BeanEndpoint.onProviderExchange(BeanEndpoint.java:235) 
>
>     at 
> org.apache.servicemix.bean.BeanEndpoint.process(BeanEndpoint.java:211)
>     at 
> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538) 
>
>     at 
> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490) 
>
>     at 
> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46) 
>
>     at 
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610) 
>
>     at 
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172) 
>
>     at 
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167) 
>
>     at 
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134) 
>
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) 
>
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) 
>
>     at java.lang.Thread.run(Thread.java:613)
>
>
> DSL for the camel route is
>         from("jbi:endpoint:http://xxx/jms/consumer")
>                 
> .errorHandler(deadLetterChannel("seda:errors").maximumRedeliveries(-1))
>                 .loadBalance()
>                 .roundRobin()
>                 .to(
>                         "jbi:endpoint:http://xxx/service/endpoint1",
>                         "jbi:endpoint:http://xxx/service/endpoint2",
>                         "jbi:endpoint:http://xxx/service/endpoint3",
>                         "jbi:endpoint:http://xxx/service/endpoint4");
>
> The bean looks like this
>
>     public void onMessageExchange(MessageExchange exchange)
>             throws MessagingException {
>
>         NormalizedMessage message = exchange.getMessage("in");
>
>         String ep = exchange.getEndpoint().getEndpointName();
>         if (ep == null) ep = "null";
>        
>         if (ep.equals("endpoint1") || ep.equals("endpoint2")) {
>             exchange.setError(new Exception("big bad exception 
> occured"));
>             channel.send(exchange);
>         }
>         exchange.setStatus(ExchangeStatus.DONE);
>         channel.send(exchange);
>     }
>
>
> The JMS config (currently) looks like this:
>
>   <jms:endpoint service="xxx:jms"
>        endpoint="provider"
>        role="provider"
>        destinationStyle="queue"
>        jmsProviderDestinationName="xxx.queue"
>        defaultMep="http://www.w3.org/2004/08/wsdl/in-only"
>        connectionFactory="#connectionFactory"/>
>
>  <jms:endpoint service="xxx:jms"
>         endpoint="consumer"
>         role="consumer"
>         defaultMep="http://www.w3.org/2004/08/wsdl/in-only"
>         destinationStyle="queue"
>         jmsProviderDestinationName="xxx.queue"
>         connectionFactory="#connectionFactory"
>         />
>
> I've also tried
> a) using the new JMS endpoints with the jencks pools
> b) setting the consumer defaultMep to robust-in-only and in-opt-out
> c) appending ?mep=in-out  etc  to the from() rule in the Camel config.
>
> Nothing seems to get rid of this error message.
>
> I'm sure there's something basic that I'm missing.
>
> Any help will be gratefully appreciated.
>
> Thanks
> Adrian Plunkett


Re: ERROR - BeanComponent - Error setting exchange status to ERROR

Posted by Adrian Plunkett <ad...@gmail.com>.
Silly mistake.

Thanks very much, Gert.

Regards,
Adrian

On 31/08/2008, at 9:08 PM, Gert Vanthienen wrote:

> Adrian,
>
> I think the problem is in your bean SU code.  If the endpoint is  
> endpoint1 or endpoint2, you are sending the exchange with the status  
> set to ERROR.  Right after that, you try to set the exchange status  
> to DONE.  However, you can not do that to an exchange you already  
> sent before -- hence the exception when you call th setStatus()  
> method.
> You probably want to add an 'else' to your code, only setting the  
> exchange status to DONE if it hasn't ended in error.
>
> Regards,
>
> Gert
>
>
>
> Adrian Plunkett wrote:
>> Hi,
>>
>> I have a flow CXFBC -> CXFSE -> JMS -> CAMEL -> BEAN.
>>
>> The bean maintains a connection to an external network service.
>> The camel component load balances over several instances of the bean.
>> The jms component decouples the front-end web service interface  
>> from the beans.
>> The cxf components provide a web-service interface.
>>
>> This is implemented in Servicemix 3.2.2 running on OS/X.
>>
>> If my bean experiences a problem (ie network disconnect from remote  
>> server), the message exchange should fail and the message returned  
>> to the jms queue.
>> This is working as expected, but more by chance than design.
>>
>> An extract of the servicemix log is supplied below:
>>
>> DEBUG - BeanComponent                  - Received exchange: status:  
>> Active, role: provider
>> DEBUG - BeanComponent                  - Retrieved correlation id:  
>> null
>> INFO  - SmppClient                     - message received by: smpp1
>> DEBUG - DeliveryChannelImpl            - Send ID: 
>> 10.0.1.197-11c1754de9f-17:2 in DeliveryChannel{servicemix-bean}
>> DEBUG - SecuredBroker                  - send exchange with secure  
>> broker
>> DEBUG - SedaFlow                       - Called Flow send
>> INFO  - SmppClient                     - From number: 61400033655
>> INFO  - SmppClient                     - To number: 61400033655
>> INFO  - SmppClient                     - Message:  
>> org 
>> .apache 
>> .servicemix.jbi.messaging.NormalizedMessageImpl@64dcc{properties:  
>> {message=test message, toNumber=61400033655, fromNumber=61400033655}}
>> ERROR - BeanComponent                  - Error processing exchange  
>> InOnly[
>>  id: ID:10.0.1.197-11c1754de9f-17:2
>>  status: Error
>>  role: provider
>>  endpoint: smpp1
>>  in: null
>>  error: java.lang.Exception: big bad exception occured
>> ]
>> java.lang.IllegalStateException: component is not owner
>>    at  
>> org 
>> .apache 
>> .servicemix 
>> .jbi 
>> .messaging.MessageExchangeImpl.setStatus(MessageExchangeImpl.java: 
>> 251)
>>    at  
>> au 
>> .com.sensis.voice.sms.SmppClient.onMessageExchange(SmppClient.java: 
>> 296)
>>    at  
>> org 
>> .apache 
>> .servicemix.bean.BeanEndpoint.onProviderExchange(BeanEndpoint.java: 
>> 235)
>>    at  
>> org.apache.servicemix.bean.BeanEndpoint.process(BeanEndpoint.java: 
>> 211)
>>    at  
>> org 
>> .apache 
>> .servicemix 
>> .common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538)
>>    at  
>> org 
>> .apache 
>> .servicemix 
>> .common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java: 
>> 490)
>>    at  
>> org 
>> .apache 
>> .servicemix 
>> .common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
>>    at  
>> org 
>> .apache 
>> .servicemix 
>> .jbi 
>> .messaging 
>> .DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610)
>>    at  
>> org 
>> .apache 
>> .servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java: 
>> 172)
>>    at  
>> org 
>> .apache 
>> .servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
>>    at org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue 
>> $1.run(SedaQueue.java:134)
>>    at java.util.concurrent.ThreadPoolExecutor 
>> $Worker.runTask(ThreadPoolExecutor.java:650)
>>    at java.util.concurrent.ThreadPoolExecutor 
>> $Worker.run(ThreadPoolExecutor.java:675)
>>    at java.lang.Thread.run(Thread.java:613)
>>
>>
>> DSL for the camel route is
>>        from("jbi:endpoint:http://xxx/jms/consumer")
>>                .errorHandler 
>> (deadLetterChannel("seda:errors").maximumRedeliveries(-1))
>>                .loadBalance()
>>                .roundRobin()
>>                .to(
>>                        "jbi:endpoint:http://xxx/service/endpoint1",
>>                        "jbi:endpoint:http://xxx/service/endpoint2",
>>                        "jbi:endpoint:http://xxx/service/endpoint3",
>>                        "jbi:endpoint:http://xxx/service/endpoint4");
>>
>> The bean looks like this
>>
>>    public void onMessageExchange(MessageExchange exchange)
>>            throws MessagingException {
>>
>>        NormalizedMessage message = exchange.getMessage("in");
>>
>>        String ep = exchange.getEndpoint().getEndpointName();
>>        if (ep == null) ep = "null";
>>               if (ep.equals("endpoint1") || ep.equals("endpoint2")) {
>>            exchange.setError(new Exception("big bad exception  
>> occured"));
>>            channel.send(exchange);
>>        }
>>        exchange.setStatus(ExchangeStatus.DONE);
>>        channel.send(exchange);
>>    }
>>
>>
>> The JMS config (currently) looks like this:
>>
>>  <jms:endpoint service="xxx:jms"
>>       endpoint="provider"
>>       role="provider"
>>       destinationStyle="queue"
>>       jmsProviderDestinationName="xxx.queue"
>>       defaultMep="http://www.w3.org/2004/08/wsdl/in-only"
>>       connectionFactory="#connectionFactory"/>
>>
>> <jms:endpoint service="xxx:jms"
>>        endpoint="consumer"
>>        role="consumer"
>>        defaultMep="http://www.w3.org/2004/08/wsdl/in-only"
>>        destinationStyle="queue"
>>        jmsProviderDestinationName="xxx.queue"
>>        connectionFactory="#connectionFactory"
>>        />
>>
>> I've also tried
>> a) using the new JMS endpoints with the jencks pools
>> b) setting the consumer defaultMep to robust-in-only and in-opt-out
>> c) appending ?mep=in-out  etc  to the from() rule in the Camel  
>> config.
>>
>> Nothing seems to get rid of this error message.
>>
>> I'm sure there's something basic that I'm missing.
>>
>> Any help will be gratefully appreciated.
>>
>> Thanks
>> Adrian Plunkett
>