Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 41607 invoked from network); 3 Jun 2009 04:31:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 3 Jun 2009 04:31:13 -0000 Received: (qmail 51426 invoked by uid 500); 3 Jun 2009 04:31:25 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 51360 invoked by uid 500); 3 Jun 2009 04:31:25 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 51350 invoked by uid 99); 3 Jun 2009 04:31:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Jun 2009 04:31:25 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of claus.ibsen@gmail.com designates 209.85.218.226 as permitted sender) Received: from [209.85.218.226] (HELO mail-bw0-f226.google.com) (209.85.218.226) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Jun 2009 04:31:13 +0000 Received: by bwz26 with SMTP id 26so7969567bwz.20 for ; Tue, 02 Jun 2009 21:30:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=Oj+dACK8Y5mA612/29FVo0gpbLb/Uq488Q6YpuKaVCw=; b=TWHfG2Ps73qc8NhEJrtax5yJEj6yv0SIKySvQ6teSjLYeDyIzOGd+D+LvRnJdQF605 XtB2sZPW2NPqhgyWw8qgndhxVE8sGnXSlh8+1kJnrNWVCiw1U92GvUfYEvGlC+FRpn1G a1kKarBXT7GGxspUMrwH6RvFErD3DBIUyEviM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=rdTOWj47iBdlYhiBjxSLHiyWqW8EevQWw7V4DeAaXypldFG7v0cVdVPy/GL8f449cm 2THcURydW5Yfa31Go+kZk7P5xFnvMUN6Sm+IFYUFb0s6cXynk955bHqZv7sYZvEU7EsB 5d1XLzlHzsNFy9OcLks7VAND/nJDTg4NYNkkI= MIME-Version: 1.0 Received: by 10.223.110.211 with SMTP id o19mr180446fap.57.1244003452168; Tue, 02 Jun 2009 21:30:52 -0700 (PDT) In-Reply-To: <9760dc1c0906020802v73356c95j2d83ebf804a8964a@mail.gmail.com> References: <9760dc1c0906020802v73356c95j2d83ebf804a8964a@mail.gmail.com> From: Claus Ibsen Date: Wed, 3 Jun 2009 06:30:31 +0200 Message-ID: <5380c69c0906022130r5055a048o3d69e162f146f35f@mail.gmail.com> Subject: Re: all messages go to dead letter channel To: users@camel.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Hi You got a NPE exception at: java.lang.NullPointerException at org.apache.camel.impl.DefaultMessage.getHeader(DefaultMessage.java:49) I guess the problem is that you manually creates these message objects. Some of them might need to have the CamelContext or some parent object set as well. But check line 49 in this source file to see what the NPE is. On Tue, Jun 2, 2009 at 5:02 PM, Ethan Aubin wrote: > Hi, I'm trying to write a camel component which reads a value from a > socket and logs the results. I'm doing something wrong in the > component or in the configuration of my route as the value always is > delivered to the dead letter channel and fails with the following > exception > > SEVERE: Failed delivery for exchangeId: > ID-eaubin-1/51474-1243953466200/1-3. On delivery attempt: 0 caught: > java.lang.ClassCastException: > com.sun.org.apache.xerces.internal.dom.DocumentImpl cannot be cast to > org.apache.camel.converter.stream.StreamCache > java.lang.ClassCastException: > com.sun.org.apache.xerces.internal.dom.DocumentImpl cannot be cast to > org.apache.camel.converter.stream.StreamCache > at org.apache.camel.component.log.LogFormatter.getBodyAsString(LogFormatt= er.java:182) > at org.apache.camel.component.log.LogFormatter.format(LogFormatter.java:7= 4) > at org.apache.camel.processor.Logger.logMessage(Logger.java:234) > at org.apache.camel.processor.Logger.process(Logger.java:88) > at org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.j= ava:92) > at org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.ja= va:66) > at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorT= oAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:43) > at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:84= ) > at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel= .java:189) > at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel= .java:133) > at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProce= ssor.java:52) > at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelpe= r.java:41) > at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyn= cProcessor.java:66) > at edu.mit.ll.ncint.camel.XmlTcpConsumer$SocketProcessor.passDocument(Xml= TcpConsumer.java:221) > at edu.mit.ll.ncint.camel.XmlTcpConsumer$SocketProcessor.readDocument(Xml= TcpConsumer.java:167) > at edu.mit.ll.ncint.camel.XmlTcpConsumer$SocketProcessor.run(XmlTcpConsum= er.java:201) > at java.lang.Thread.run(Thread.java:637) > java.lang.NullPointerException > at org.apache.camel.impl.DefaultMessage.getHeader(DefaultMessage.java:49) > at org.apache.camel.processor.DeadLetterChannel.incrementRedeliveryCounte= r(DeadLetterChannel.java:430) > at org.apache.camel.processor.DeadLetterChannel.handleException(DeadLette= rChannel.java:287) > at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel= .java:162) > at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel= .java:133) > at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProce= ssor.java:52) > at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelpe= r.java:41) > at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyn= cProcessor.java:66) > at edu.mit.ll.ncint.camel.XmlTcpConsumer$SocketProcessor.passDocument(Xml= TcpConsumer.java:221) > at edu.mit.ll.ncint.camel.XmlTcpConsumer$SocketProcessor.readDocument(Xml= TcpConsumer.java:167) > at edu.mit.ll.ncint.camel.XmlTcpConsumer$SocketProcessor.run(XmlTcpConsum= er.java:201) > at java.lang.Thread.run(Thread.java:637) > > > Camel is started using > > =A0 =A0 =A0 =A0context =3D new DefaultCamelContext(new JndiRegistry()); > =A0 =A0 =A0 =A0context.addComponent("xmltcp", new XmlTcpComponent(context= )); > =A0 =A0 =A0 =A0ccEndpoint =3D context.getEndpoint("xmltcp://127.0.0.1:150= 01"); > =A0 =A0 =A0 =A0context.addRoutes(new RouteBuilder() { > =A0 =A0 =A0 =A0 =A0 =A0@Override > =A0 =A0 =A0 =A0 =A0 =A0public void configure() { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0from(ccEndpoint).to("log:loggingCategoryFo= o?level=3DINFO"); > =A0 =A0 =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0}); > =A0 =A0 =A0 =A0context.start(); > > After the value has been read from the socket the consumer delivers it wi= th: > > =A0 =A0 =A0 =A0 =A0 DefaultMessage msg =3D new DefaultMessage(); > =A0 =A0 =A0 =A0 =A0 =A0msg.setBody(obj); > =A0 =A0 =A0 =A0 =A0 =A0XmlTcpExchange ex =3D endpoint.createExchange(); > =A0 =A0 =A0 =A0 =A0 =A0ex.setIn(msg); > =A0 =A0 =A0 =A0 =A0 =A0getProcessor().process(ex); > > > The consumer, component, endpoint and exchange all inherit from > default classes and don't do anything particularly interesting =A0(I can > send the code if that would help). What could be going on here? Many > thanks =A0- Ethan > --=20 Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus