You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ychawla <pr...@yahoo.com> on 2012/02/17 01:13:55 UTC

Propogate CXF Exception to Camel

Hello All,
Consider a simple camel route like this that invokes a one way service:

    <camel:route errorHandlerRef="myDeadLetterErrorHandler">
      <camel:from uri="inputDir"/>
               <camel:setHeader
headerName="operationName"><constant>opName</constant></camel:setHeader>
                <camel:setHeader
headerName="operationNamespace"><constant>opNamespace</constant></camel:setHeader>
                <camel:to uri="cxf:bean:myService?dataFormat=PAYLOAD"/>
               
    </camel:route>

If the endpoint you are invoking is down, CXF will throw an exception:

Caused by: java.net.ConnectException: Connection refused
        at java.net.PlainSocketImpl.socketConnect(Native Method)[:1.6.0_29]
        at
java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)[:1.6.0_29]
        at
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)[:1.6.0_29]
        at
java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)[:1.6.0_29]
        at
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432)[:1.6.0_29] 

I thought that the error handler that I set on the route would handle this
for me and I could configure the retries and retry interval.  However, this
exception never makes it back to the exchange on the route.

I tried to set up a CXF phase interceptor to handle this, but I was unable
to put the CXF exception onto the Camel exchange.  Please see this related
post on the CXF list for more details on the interceptor configuration:

http://cxf.547215.n5.nabble.com/CXF-Camel-JMS-Endpoint-exception-handling-td4471174.html#a5490748

I also tried to grab the out of band headers from the exchanges and check
the HTTP status for a 200 response, but these appear to only be available in
POJO mode.  I figured I could throw an exception for a status other than 200
since I have a one way service.

I find this strange.  Should an exception thrown in the CXF interceptor
chain makes it way back to the Camel exchange?  Am I missing something here?

Thanks,
Yogesh

--
View this message in context: http://camel.465427.n5.nabble.com/Propogate-CXF-Exception-to-Camel-tp5491102p5491102.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Propogate CXF Exception to Camel

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

How does your DeadLetterErrorHandler looks like ?
I just wrote an simple test case on the camel-cxf[1] and the camel can 
get the exception when the server is down.

BTW, can you show me the full stack trace ?
[1] http://svn.apache.org/viewvc?rev=1245288&view=rev

Willem

On Fri Feb 17 08:13:55 2012, ychawla wrote:
> Hello All,
> Consider a simple camel route like this that invokes a one way service:
>
>      <camel:route errorHandlerRef="myDeadLetterErrorHandler">
>        <camel:from uri="inputDir"/>
>                 <camel:setHeader
> headerName="operationName"><constant>opName</constant></camel:setHeader>
>                  <camel:setHeader
> headerName="operationNamespace"><constant>opNamespace</constant></camel:setHeader>
>                  <camel:to uri="cxf:bean:myService?dataFormat=PAYLOAD"/>
>
>      </camel:route>
>
> If the endpoint you are invoking is down, CXF will throw an exception:
>
> Caused by: java.net.ConnectException: Connection refused
>          at java.net.PlainSocketImpl.socketConnect(Native Method)[:1.6.0_29]
>          at
> java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)[:1.6.0_29]
>          at
> java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)[:1.6.0_29]
>          at
> java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)[:1.6.0_29]
>          at
> java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432)[:1.6.0_29]
>
> I thought that the error handler that I set on the route would handle this
> for me and I could configure the retries and retry interval.  However, this
> exception never makes it back to the exchange on the route.
>
> I tried to set up a CXF phase interceptor to handle this, but I was unable
> to put the CXF exception onto the Camel exchange.  Please see this related
> post on the CXF list for more details on the interceptor configuration:
>
> http://cxf.547215.n5.nabble.com/CXF-Camel-JMS-Endpoint-exception-handling-td4471174.html#a5490748
>
> I also tried to grab the out of band headers from the exchanges and check
> the HTTP status for a 200 response, but these appear to only be available in
> POJO mode.  I figured I could throw an exception for a status other than 200
> since I have a one way service.
>
> I find this strange.  Should an exception thrown in the CXF interceptor
> chain makes it way back to the Camel exchange?  Am I missing something here?
>
> Thanks,
> Yogesh
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Propogate-CXF-Exception-to-Camel-tp5491102p5491102.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Re: Propogate CXF Exception to Camel

Posted by ychawla <pr...@yahoo.com>.
Hi Willem,
Thanks for posting the unit test.  I am wondering if I am getting the error
because I am using a one-way exchange.  For example, I also tried this with
a producer template:

        senderExchange = new DefaultExchange(context,
ExchangePattern.InOnly);
        enderExchange.getIn().setBody(exchange.getIn().getBody());
        
	    ProducerTemplate template = context.createProducerTemplate();

	    senderExchange.getIn().setHeader(CxfConstants.OPERATION_NAME,
getOperationName());
	    senderExchange.getIn().setHeader(CxfConstants.OPERATION_NAMESPACE,
getOperationNamespace());
	    
		Exchange returnExchange = template.send("cxf:bean:" + destinationEndpoint
+ "?dataFormat=PAYLOAD",
				senderExchange);

With this InOnly pattern, the exception doesn't get back to me.  

Thanks,
Yogesh

--
View this message in context: http://camel.465427.n5.nabble.com/Propogate-CXF-Exception-to-Camel-tp5491102p5491276.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Propogate CXF Exception to Camel

Posted by Willem <wi...@gmail.com>.
Can I have a look at your cxf:bean configuration?
CxfProducer should be able to throw the exception out.

Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang 
Weibo: willemjiang

On Mar 3, 2012, at 6:23 AM, ychawla wrote:

> Hi Willem,
> I upgraded to Camel 2.8.4 and CXF 2.4.6 and I still see this behavior.  Here
> is my route.  It basically reads from a folder and calls a web service:
> 
> 		<endpoint id="foobarWebserviceEndpoint"
> 		
> uri="cxf:bean:foobarRelocationService?dataFormat=PAYLOAD&amp;loggingFeatureEnabled=true"
> />
> 
> 		
> 		<camel:route id="foobarRelocationHandlerConnector"
> errorHandlerRef="foobarRelocationDeadLetterErrorHandler">
> 			<camel:from uri="foobarRelocationInputDir" />
> 			<camel:log message="Received file for foobar Relocations: ${file:name}"
> />
> 			<camel:setHeader headerName="operationName">
> 				<constant>opName</constant>
> 			</camel:setHeader>
> 			<camel:setHeader headerName="operationNamespace">
> 				<constant>http://www.namespace.com/</constant>
> 			</camel:setHeader>
> 			<camel:to uri="foobarWebserviceEndpoint" />
> 			<camel:log message="Called foobar intermediary" />
> 		</camel:route>
> 
> 	</camel:camelContext>
> 
> 	
> 	<bean id="foobarRelocationDeadLetterErrorHandler"
> class="org.apache.camel.builder.DeadLetterChannelBuilder">
> 		
> 		<property name="deadLetterUri" value="foobarRelocationDeadLetterDir" />
> 		
> 		<property name="redeliveryPolicy"
> ref="foobarRelocationRedeliveryPolicyConfig" />
> 	</bean>
> 
> 	
> 	<bean id="foobarRelocationRedeliveryPolicyConfig"
> class="org.apache.camel.processor.RedeliveryPolicy">
> 		
> 		<property name="maximumRedeliveries" value="3" />
> 		
> 		<property name="redeliveryDelay" value="5000" />
> 	</bean>
> 
> I get a connection refused error when I shut down the server:
> 
> [rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
> Invoking handleFault on interceptor
> org.apache.cxf.interceptor.BareOutInterceptor@4320d68d
> [rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
> Invoking handleFault on interceptor
> org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor@5538615e
> [rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
> Invoking handleFault on interceptor
> org.apache.cxf.ws.addressing.soap.MAPCodec@465e34ce
> [rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
> Invoking handleFault on interceptor
> org.apache.cxf.interceptor.StaxOutInterceptor@5123ac44
> [rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
> Invoking handleFault on interceptor
> org.apache.cxf.interceptor.AttachmentOutInterceptor@674a93a6
> [rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
> Invoking handleFault on interceptor
> org.apache.cxf.interceptor.LoggingOutInterceptor@491f03e4
> [rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
> Invoking handleFault on interceptor
> org.apache.cxf.interceptor.MessageSenderInterceptor@1338933d
> [rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
> Invoking handleFault on interceptor
> org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor@20e5e569
> [rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
> Invoking handleFault on interceptor
> org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor@7d02cdf9
> [rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
> Invoking handleFault on interceptor
> org.apache.cxf.ws.addressing.MAPAggregator@5c04e904
> [rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
> Invoking handleFault on interceptor
> org.apache.cxf.ws.policy.PolicyOutInterceptor@7f1ef3e7
> [rna/relocation/connector/input] PhaseInterceptorChain          WARN 
> Interceptor for
> {http://www.XXX.com}FOOBAR-Relocation#{http://www.XXX.com/1.0.0}SubmitFOOBARPackage
> has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: Could not generate the XML stream caused
> by: com.ctc.wstx.exc.WstxIOException: Connection refused.
> 	at
> org.apache.cxf.databinding.source.XMLStreamDataWriter.write(XMLStreamDataWriter.java:91)[cxf-rt-core-2.4.6.jar:2.4.6]
> 	at
> org.apache.cxf.databinding.source.XMLStreamDataWriter.write(XMLStreamDataWriter.java:50)[cxf-rt-core-2.4.6.jar:2.4.6]
> 	at
> org.apache.camel.component.cxf.HybridSourceDataBinding$1.write(HybridSourceDataBinding.java:101)[camel-cxf-2.8.4.jar:2.8.4]
> 
> After this the route continues rather than trying redelivery.  If I throw an
> exception processor in there:
> 
> 	<camel:to uri="bean:throwit"/>
> 
> 	<bean id="throwit" class="org.search.processor.Process"/>
> 
> Then I see the redelivery attempts happen.  This does not happen with the
> web service 'connection refused' though...
> 
> Any ideas?
> 
> Thanks,
> Yogesh
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Propogate-CXF-Exception-to-Camel-tp5491102p5532402.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Propogate CXF Exception to Camel

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi guys,

maybe it doesn't help, but I used two routes like this:

from cxf -> to jms
from jms -> to cxf

and to "transport" the exception from the "to cxf" to the "from cxf", I 
added the transferException=true on the two JMS endpoints.

Regards
JB

On 03/08/2012 08:32 AM, Willem Jiang wrote:
> Hi Yogesh,
>
> What kind of custom interceptor are you using?
>
> By adding the synchronous=true parameter, camel-cxf will not use the
> async invocation which is used by default to invoke the server.
>
>
>
> On 3/7/12 10:58 PM, ychawla wrote:
>> Hi Aki,
>> I do have a one-way service. I added the 'synchronous=true' to the
>> endpoint
>> and now it is throwing the error without using my custom interceptor.
>> Will
>> setting this attribute affect other behavior of the one-way service?
>>
>> Thanks,
>> Yogesh
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Propogate-CXF-Exception-to-Camel-tp5491102p5544347.html
>>
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Propogate CXF Exception to Camel

Posted by Willem Jiang <wi...@gmail.com>.
Hi Yogesh,

What kind of custom interceptor are you using?

By adding the synchronous=true parameter, camel-cxf will not use the 
async invocation which is used by default to invoke the server.



On 3/7/12 10:58 PM, ychawla wrote:
> Hi Aki,
> I do have a one-way service.  I added the 'synchronous=true' to the endpoint
> and now it is throwing the error without using my custom interceptor.  Will
> setting this attribute affect other behavior of the one-way service?
>
> Thanks,
> Yogesh
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Propogate-CXF-Exception-to-Camel-tp5491102p5544347.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Re: Propogate CXF Exception to Camel

Posted by Aki Yoshida <el...@googlemail.com>.
Hi Yogesh,
This property will affect the invocation behavior at the camel-cxf
boundary. In other words, in this case, the call occurs synchronously
across this boundary.

That could be considered inefficient in some scenarios (e.g., if you
are not interested in any errors and you want to just quickly dispatch
those oneway calls).

But in any case, this property only affects the behavior at the
camel-cxf or cxf-camel boundary. And it will not affect the way how
the remote oneway web service is executed. That part depends on how
you configured that remote oneway web service.

regards, aki

2012/3/7 ychawla <pr...@yahoo.com>:
> Hi Aki,
> I do have a one-way service.  I added the 'synchronous=true' to the endpoint
> and now it is throwing the error without using my custom interceptor.  Will
> setting this attribute affect other behavior of the one-way service?
>
> Thanks,
> Yogesh
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Propogate-CXF-Exception-to-Camel-tp5491102p5544347.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Propogate CXF Exception to Camel

Posted by ychawla <pr...@yahoo.com>.
Hi Aki,
I do have a one-way service.  I added the 'synchronous=true' to the endpoint
and now it is throwing the error without using my custom interceptor.  Will
setting this attribute affect other behavior of the one-way service?

Thanks,
Yogesh

--
View this message in context: http://camel.465427.n5.nabble.com/Propogate-CXF-Exception-to-Camel-tp5491102p5544347.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Propogate CXF Exception to Camel

Posted by Aki Yoshida <el...@googlemail.com>.
Hi Yogesh,

could it be that your web service call is a oneway operation? If that
is the case, you should set the synchronous property to true
(...&synchronous=true) for the camel-cxf endpoint to get the
transmission error. See http://camel.apache.org/cxf.html for more
info. Can you try setting this property?

regards, aki


2012/3/2 ychawla <pr...@yahoo.com>:
> Hi Willem,
> I upgraded to Camel 2.8.4 and CXF 2.4.6 and I still see this behavior.  Here
> is my route.  It basically reads from a folder and calls a web service:
>
>                <endpoint id="foobarWebserviceEndpoint"
>
> uri="cxf:bean:foobarRelocationService?dataFormat=PAYLOAD&loggingFeatureEnabled=true"
> />
>
>
>                <camel:route id="foobarRelocationHandlerConnector"
> errorHandlerRef="foobarRelocationDeadLetterErrorHandler">
>                        <camel:from uri="foobarRelocationInputDir" />
>                        <camel:log message="Received file for foobar Relocations: ${file:name}"
> />
>                        <camel:setHeader headerName="operationName">
>                                <constant>opName</constant>
>                        </camel:setHeader>
>                        <camel:setHeader headerName="operationNamespace">
>                                <constant>http://www.namespace.com/</constant>
>                        </camel:setHeader>
>                        <camel:to uri="foobarWebserviceEndpoint" />
>                        <camel:log message="Called foobar intermediary" />
>                </camel:route>
>
>        </camel:camelContext>
>
>
>        <bean id="foobarRelocationDeadLetterErrorHandler"
> class="org.apache.camel.builder.DeadLetterChannelBuilder">
>
>                <property name="deadLetterUri" value="foobarRelocationDeadLetterDir" />
>
>                <property name="redeliveryPolicy"
> ref="foobarRelocationRedeliveryPolicyConfig" />
>        </bean>
>
>
>        <bean id="foobarRelocationRedeliveryPolicyConfig"
> class="org.apache.camel.processor.RedeliveryPolicy">
>
>                <property name="maximumRedeliveries" value="3" />
>
>                <property name="redeliveryDelay" value="5000" />
>        </bean>
>
> I get a connection refused error when I shut down the server:
>
> [rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
> Invoking handleFault on interceptor
> org.apache.cxf.interceptor.BareOutInterceptor@4320d68d
> [rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
> Invoking handleFault on interceptor
> org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor@5538615e
> [rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
> Invoking handleFault on interceptor
> org.apache.cxf.ws.addressing.soap.MAPCodec@465e34ce
> [rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
> Invoking handleFault on interceptor
> org.apache.cxf.interceptor.StaxOutInterceptor@5123ac44
> [rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
> Invoking handleFault on interceptor
> org.apache.cxf.interceptor.AttachmentOutInterceptor@674a93a6
> [rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
> Invoking handleFault on interceptor
> org.apache.cxf.interceptor.LoggingOutInterceptor@491f03e4
> [rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
> Invoking handleFault on interceptor
> org.apache.cxf.interceptor.MessageSenderInterceptor@1338933d
> [rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
> Invoking handleFault on interceptor
> org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor@20e5e569
> [rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
> Invoking handleFault on interceptor
> org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor@7d02cdf9
> [rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
> Invoking handleFault on interceptor
> org.apache.cxf.ws.addressing.MAPAggregator@5c04e904
> [rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
> Invoking handleFault on interceptor
> org.apache.cxf.ws.policy.PolicyOutInterceptor@7f1ef3e7
> [rna/relocation/connector/input] PhaseInterceptorChain          WARN
> Interceptor for
> {http://www.XXX.com}FOOBAR-Relocation#{http://www.XXX.com/1.0.0}SubmitFOOBARPackage
> has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: Could not generate the XML stream caused
> by: com.ctc.wstx.exc.WstxIOException: Connection refused.
>        at
> org.apache.cxf.databinding.source.XMLStreamDataWriter.write(XMLStreamDataWriter.java:91)[cxf-rt-core-2.4.6.jar:2.4.6]
>        at
> org.apache.cxf.databinding.source.XMLStreamDataWriter.write(XMLStreamDataWriter.java:50)[cxf-rt-core-2.4.6.jar:2.4.6]
>        at
> org.apache.camel.component.cxf.HybridSourceDataBinding$1.write(HybridSourceDataBinding.java:101)[camel-cxf-2.8.4.jar:2.8.4]
>
> After this the route continues rather than trying redelivery.  If I throw an
> exception processor in there:
>
>        <camel:to uri="bean:throwit"/>
>
>        <bean id="throwit" class="org.search.processor.Process"/>
>
> Then I see the redelivery attempts happen.  This does not happen with the
> web service 'connection refused' though...
>
> Any ideas?
>
> Thanks,
> Yogesh
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Propogate-CXF-Exception-to-Camel-tp5491102p5532402.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Propogate CXF Exception to Camel

Posted by ychawla <pr...@yahoo.com>.
Hi Willem,
I upgraded to Camel 2.8.4 and CXF 2.4.6 and I still see this behavior.  Here
is my route.  It basically reads from a folder and calls a web service:

		<endpoint id="foobarWebserviceEndpoint"
		
uri="cxf:bean:foobarRelocationService?dataFormat=PAYLOAD&amp;loggingFeatureEnabled=true"
/>

		
		<camel:route id="foobarRelocationHandlerConnector"
errorHandlerRef="foobarRelocationDeadLetterErrorHandler">
			<camel:from uri="foobarRelocationInputDir" />
			<camel:log message="Received file for foobar Relocations: ${file:name}"
/>
			<camel:setHeader headerName="operationName">
				<constant>opName</constant>
			</camel:setHeader>
			<camel:setHeader headerName="operationNamespace">
				<constant>http://www.namespace.com/</constant>
			</camel:setHeader>
			<camel:to uri="foobarWebserviceEndpoint" />
			<camel:log message="Called foobar intermediary" />
		</camel:route>

	</camel:camelContext>

	
	<bean id="foobarRelocationDeadLetterErrorHandler"
class="org.apache.camel.builder.DeadLetterChannelBuilder">
		
		<property name="deadLetterUri" value="foobarRelocationDeadLetterDir" />
		
		<property name="redeliveryPolicy"
ref="foobarRelocationRedeliveryPolicyConfig" />
	</bean>

	
	<bean id="foobarRelocationRedeliveryPolicyConfig"
class="org.apache.camel.processor.RedeliveryPolicy">
		
		<property name="maximumRedeliveries" value="3" />
		
		<property name="redeliveryDelay" value="5000" />
	</bean>

I get a connection refused error when I shut down the server:

[rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
Invoking handleFault on interceptor
org.apache.cxf.interceptor.BareOutInterceptor@4320d68d
[rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
Invoking handleFault on interceptor
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor@5538615e
[rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
Invoking handleFault on interceptor
org.apache.cxf.ws.addressing.soap.MAPCodec@465e34ce
[rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
Invoking handleFault on interceptor
org.apache.cxf.interceptor.StaxOutInterceptor@5123ac44
[rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
Invoking handleFault on interceptor
org.apache.cxf.interceptor.AttachmentOutInterceptor@674a93a6
[rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
Invoking handleFault on interceptor
org.apache.cxf.interceptor.LoggingOutInterceptor@491f03e4
[rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
Invoking handleFault on interceptor
org.apache.cxf.interceptor.MessageSenderInterceptor@1338933d
[rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
Invoking handleFault on interceptor
org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor@20e5e569
[rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
Invoking handleFault on interceptor
org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor@7d02cdf9
[rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
Invoking handleFault on interceptor
org.apache.cxf.ws.addressing.MAPAggregator@5c04e904
[rna/relocation/connector/input] PhaseInterceptorChain          DEBUG
Invoking handleFault on interceptor
org.apache.cxf.ws.policy.PolicyOutInterceptor@7f1ef3e7
[rna/relocation/connector/input] PhaseInterceptorChain          WARN 
Interceptor for
{http://www.XXX.com}FOOBAR-Relocation#{http://www.XXX.com/1.0.0}SubmitFOOBARPackage
has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not generate the XML stream caused
by: com.ctc.wstx.exc.WstxIOException: Connection refused.
	at
org.apache.cxf.databinding.source.XMLStreamDataWriter.write(XMLStreamDataWriter.java:91)[cxf-rt-core-2.4.6.jar:2.4.6]
	at
org.apache.cxf.databinding.source.XMLStreamDataWriter.write(XMLStreamDataWriter.java:50)[cxf-rt-core-2.4.6.jar:2.4.6]
	at
org.apache.camel.component.cxf.HybridSourceDataBinding$1.write(HybridSourceDataBinding.java:101)[camel-cxf-2.8.4.jar:2.8.4]

After this the route continues rather than trying redelivery.  If I throw an
exception processor in there:

	<camel:to uri="bean:throwit"/>

	<bean id="throwit" class="org.search.processor.Process"/>

Then I see the redelivery attempts happen.  This does not happen with the
web service 'connection refused' though...

Any ideas?

Thanks,
Yogesh

--
View this message in context: http://camel.465427.n5.nabble.com/Propogate-CXF-Exception-to-Camel-tp5491102p5532402.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Propogate CXF Exception to Camel

Posted by Willem Jiang <wi...@gmail.com>.
It takes me a while to trace the issue[1], just for the user who 
interesting about this issue.
[1] https://issues.apache.org/jira/browse/CAMEL-3987

On Fri Feb 17 10:28:17 2012, ychawla wrote:
> Well Willem,
> You have solved the problem...  It is a bug with Camel 2.6.0 that is
> corrected in Camel 2.8.4.  I am on ServiceMix 4.3.0 and that ships with
> Camel 2.6.0.
>
> I changed my POM to use the newer version of Camel and CXF and ran it in
> Eclipse just fine.
>
> Thanks for helping with this.
>
> -Yogesh
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Propogate-CXF-Exception-to-Camel-tp5491102p5491299.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang 
Weibo: willemjiang 


Re: Propogate CXF Exception to Camel

Posted by ychawla <pr...@yahoo.com>.
Well Willem,
You have solved the problem...  It is a bug with Camel 2.6.0 that is
corrected in Camel 2.8.4.  I am on ServiceMix 4.3.0 and that ships with
Camel 2.6.0.

I changed my POM to use the newer version of Camel and CXF and ran it in
Eclipse just fine.

Thanks for helping with this.

-Yogesh

--
View this message in context: http://camel.465427.n5.nabble.com/Propogate-CXF-Exception-to-Camel-tp5491102p5491299.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Propogate CXF Exception to Camel

Posted by Willem Jiang <wi...@gmail.com>.
CXF should be able to throw the ConnectException out in current trunk.
Which version of Camel are you using ?

Willem
On Fri Feb 17 10:02:11 2012, ychawla wrote:
> Hello All,
> I got Camel to see the exception by throwing a fault in my interceptor.
> This is probably not the preferred way to do this, but it seemed to work:
>
> public class CamelExceptionInterceptor extends
> AbstractPhaseInterceptor<Message>  {
>
> 	public CamelExceptionInterceptor() {
> 		super(Phase.SETUP);
> 	}
>
>      @Override
>      public void handleFault(Message message)
>      {
>              Exception exception = message.getContent(Exception.class);
>              throw new Fault(exception);
>
>      }
>
> 	@Override
> 	public void handleMessage(Message message) throws Fault {
> 	}
> }
>
> I then wired this interceptor into my Camel route.  I had to hunt a while to
> see what phase it was bombing out on, but this worked:
>
>    <cxf:cxfEndpoint
>      id="myService"
>      address="http://localhost/service"
>      wsdlURL="service.wsdl"
>      serviceName="test:ServiceService"
>      endpointName="test:Service"
>      xmlns:test="http://test.com"
>      >
>      <cxf:outInterceptors>
>      	<ref bean="camelExceptionInterceptor"/>
>      </cxf:outInterceptors>
>    </cxf:cxfEndpoint>
>
> Maybe this fault did not propogate because in my test scenario, a connection
> could not be established so it wasn't far enough in the CXF chain to
> propogate the exception?
>
> Thanks,
> Yogesh
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Propogate-CXF-Exception-to-Camel-tp5491102p5491265.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang 
Weibo: willemjiang 


Re: Propogate CXF Exception to Camel

Posted by ychawla <pr...@yahoo.com>.
Hello All,
I got Camel to see the exception by throwing a fault in my interceptor. 
This is probably not the preferred way to do this, but it seemed to work:

public class CamelExceptionInterceptor extends
AbstractPhaseInterceptor<Message> {

	public CamelExceptionInterceptor() {
		super(Phase.SETUP);
	}

    @Override
    public void handleFault(Message message)
    {
            Exception exception = message.getContent(Exception.class);
            throw new Fault(exception);
            
    } 

	@Override
	public void handleMessage(Message message) throws Fault {
	} 
}

I then wired this interceptor into my Camel route.  I had to hunt a while to
see what phase it was bombing out on, but this worked:

  <cxf:cxfEndpoint 
    id="myService"
    address="http://localhost/service"
    wsdlURL="service.wsdl"
    serviceName="test:ServiceService"
    endpointName="test:Service"
    xmlns:test="http://test.com"
    >
    <cxf:outInterceptors >
    	<ref bean="camelExceptionInterceptor"/>
    </cxf:outInterceptors>
  </cxf:cxfEndpoint>

Maybe this fault did not propogate because in my test scenario, a connection
could not be established so it wasn't far enough in the CXF chain to
propogate the exception?

Thanks,
Yogesh

--
View this message in context: http://camel.465427.n5.nabble.com/Propogate-CXF-Exception-to-Camel-tp5491102p5491265.html
Sent from the Camel - Users mailing list archive at Nabble.com.