You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by jcamus <jc...@parkeon.com> on 2009/03/24 11:46:53 UTC

Problem with Camel and DeadLetter channel

Hi !
I am still having problem with the following architecture :

FilePoller In (*.xml) -> Camel routing -> FileSender (Ok)
                           (if problem : FileSender (Ko)

When a correct xml is put into In directory, camel routing works fine.
When a put an incorrect file (a bad formed xml file), the system can stop
looping with the following error message :
 id: ID:192.168.77.223-12037a9e879-8:47
 status: Active
 role: provider
 service: {http://esb.transfolio.parkeon.com}camelRouter
 endpoint: camel192-168-77-223-12037a9e879-32-10
 in: Unable to display: java.io.IOException: Stream closed

RROR - DeadLetterChannel              - Failed delivery for exchangeId:
ID-PC11726-BES/2134-1237884468106/0-36. On delivery attem
t: 0 caught: org.apache.camel.RuntimeCamelException: java.io.IOException:
Stream closed
rg.apache.camel.RuntimeCamelException: java.io.IOException: Stream closed
       at
org.apache.camel.util.ObjectHelper.invokeMethod(ObjectHelper.java:411)
       at
org.apache.camel.impl.converter.InstanceMethodTypeConverter.convertTo(InstanceMethodTypeConverter.java:50)
       at
org.apache.camel.impl.converter.DefaultTypeConverter.convertTo(DefaultTypeConverter.java:67)
       at
org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:59)
       at
org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:50)
       at
org.apache.camel.builder.xml.XPathBuilder.getDocument(XPathBuilder.java:537)
       at
org.apache.camel.builder.xml.XPathBuilder.evaluateAs(XPathBuilder.java:420)
       at
org.apache.camel.builder.xml.XPathBuilder.matches(XPathBuilder.java:98)
       at
org.apache.camel.builder.xml.XPathBuilder.matches(XPathBuilder.java:63)
       at
org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:47)
       at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)
       at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:155)
       at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:91)
       at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:57)
       at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:39)
       at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41)
       at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:66)
       at
org.apache.servicemix.camel.CamelProviderEndpoint.handleActiveProviderExchange(CamelProviderEndpoint.java:94)
       at
org.apache.servicemix.camel.CamelProviderEndpoint.process(CamelProviderEndpoint.java:73)
       at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:600)
       at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:554)
       at
org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncBaseLifeCycle.java:510)
       at
org.apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchange(SyncLifeCycleWrapper.java:60)
       at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:620)
       at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
       at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:168)
       at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
       at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
       at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
       at java.lang.Thread.run(Thread.java:619)
aused by: java.io.IOException: Stream closed
       at
java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:145)
       at java.io.BufferedInputStream.read(BufferedInputStream.java:241)
       at
org.apache.xerces.impl.XMLEntityManager$RewindableInputStream.read(Unknown
Source)
       at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown
Source)
       at
org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown
Source)
       at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
       at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
       at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
       at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
       at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
       at
org.apache.camel.converter.jaxp.XmlConverter.toDOMSourceFromStream(XmlConverter.java:366)
       at
org.apache.camel.converter.jaxp.XmlConverter.toDOMSource(XmlConverter.java:201)
       at
org.apache.camel.converter.jaxp.XmlConverter.toDOMNode(XmlConverter.java:411)
       at
org.apache.camel.converter.jaxp.XmlConverter.toDOMDocument(XmlConverter.java:519)
       at sun.reflect.GeneratedMethodAccessor180.invoke(Unknown Source)
       at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at
org.apache.camel.util.ObjectHelper.invokeMethod(ObjectHelper.java:407)
       ... 29 more
RROR - CamelJbiComponent              - Error processing exchange InOnly[
 id: ID:192.168.77.223-12037a9e879-8:47
 status: Active
 role: provider
 service: {http://esb.transfolio.parkeon.com}camelRouter
 endpoint: camel192-168-77-223-12037a9e879-32-10
 in: Unable to display: java.io.IOException: Stream closed

ava.lang.NullPointerException
       at
org.apache.camel.processor.exceptionpolicy.DefaultExceptionPolicyStrategy.getExceptionPolicy(DefaultExceptionPolicyStra
egy.java:63)
       at
org.apache.camel.processor.ErrorHandlerSupport.getExceptionPolicy(ErrorHandlerSupport.java:77)
       at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:122)
       at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:91)
       at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:57)
       at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:39)
       at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41)
       at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:66)
       at
org.apache.servicemix.camel.CamelProviderEndpoint.handleActiveProviderExchange(CamelProviderEndpoint.java:94)
       at
org.apache.servicemix.camel.CamelProviderEndpoint.process(CamelProviderEndpoint.java:73)
       at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:600)
       at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:554)
       at
org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncBaseLifeCycle.java:510)
       at
org.apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchange(SyncLifeCycleWrapper.java:60)
       at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:620)
       at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
       at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:168)
       at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
       at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
       at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
       at java.lang.Thread.run(Thread.java:619)
EBUG - DeliveryChannelImpl            - Send
ID:192.168.77.223-12037a9e879-8:47 in DeliveryChannel{servicemix-camel}
EBUG - SecuredBroker                  - send exchange with secure broker
EBUG - SedaFlow                       - Called Flow send
EBUG - SedaQueue                      -
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@1ab3480 dequeued
exchange: InOnly[
 id: ID:192.168.77.223-12037a9e879-8:47
 status: Error
 role: consumer
 service: {http://esb.transfolio.parkeon.com}camelRouter
 endpoint: camel192-168-77-223-12037a9e879-32-10
 in: Unable to display: java.io.IOException: Stream closed
 error: java.lang.NullPointerException

Here is my camel-context.xml

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:parkeon="http://esb.transfolio.parkeon.com"
	xsi:schemaLocation="
       http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
       http://activemq.apache.org/camel/schema/spring
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
       ">

	<camelContext id="camel"
		xmlns="http://activemq.apache.org/camel/schema/spring">
		<route errorHandlerRef="myDeadLetterErrorHandler">
			<from uri="jbi:service:http://esb.transfolio.parkeon.com/camelRouter" />			
			<choice>
				<when>
					<xpath>count(/stat) = 1</xpath>
					<to
					
uri="jbi:endpoint:http://esb.transfolio.parkeon.com/dataDecoder/statDataDecoder"
/>
				</when>
				<otherwise>
					<to
					
uri="jbi:endpoint:http://esb.transfolio.parkeon.com/fileSender/endpointUnknownFile"
/>
				</otherwise>
			</choice>
		</route>
	</camelContext>

	<bean id="myDeadLetterErrorHandler"
class="org.apache.camel.builder.DeadLetterChannelBuilder">
		<!-- exchanges is routed to error in cased redelivery failed -->
		<!-- <property name="defaultDeadLetterEndpointUri" -->
		<property name="defaultDeadLetterEndpointUri"
		
value="jbi:endpoint:http://esb.transfolio.parkeon.com/fileSender/endpointErrorFile"
/>
		<!-- reference the redelivery policy to use -->
		<property name="redeliveryPolicy" ref="myRedeliveryPolicyConfig" />
	</bean>

	<!-- here we set the redelivery settings -->
	<bean id="myRedeliveryPolicyConfig"
class="org.apache.camel.processor.RedeliveryPolicy">
		<!--
			when echange is dead : it is routed to the fileSender
			endpointErrorFile
		-->
		<property name="maximumRedeliveries" value="1" />
		<property name="maximumRedeliveryDelay" value="0" />
	</bean>
</beans>

-- 
View this message in context: http://www.nabble.com/Problem-with-Camel-and-DeadLetter-channel-tp22677839p22677839.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.