camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From TomStrummer <tomstrum...@gmail.com>
Subject Re: POJO services using Serializable objects as messages
Date Mon, 10 Nov 2008 19:53:55 GMT

Nope, with Camel v.1.5.0 it is the same.  It is not an error in the logger,
the problem is in the JBI component (or how I am using it).  If I send the
body to the logger directly from("jbi:endpoint....") or send to one of my
own components, I get a null object.  This is the same whether or not I try
to unmarshal the message from the JBI endpoint.


willem.jiang wrote:
> 
> Which version of camel are you using?
> There are a stream cache issue of logger which was fixed in the camel 1.5.
> 
> Willem
> 
> TomStrummer wrote:
>> Ok, so I can concede that yes, my service messages should probably be XML
>> if
>> they are going on to the JBI bus.  I decided to attempt the simplest
>> route
>> via XStream (no annotations you say??  Why yes please!)
>> 
>> So I am doing something simple like this:
>> 
>>     	from("timer://tutorial?fixedRate=true&delay=3000&period=10000")
>>     		.to("bean:bidRetriever")
>>     		.marshal().xstream()
>>     		.to("log:bidsSent")
>>     	
>> .to("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:provider");
>>     		
>>     
>> from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer")
>>     		.to("log:bidsRcvd")
>>     		.unmarshal().xstream()
>>     		.to("bean:bidPersistence");
>> 
>> 
>> but when the message is unmarshaled, it is null!  
>> 
>> Here's the log output so you can see what the message looks like.  Maybe
>> I
>> just don't understand the DSL?
>> 
>> Retrieving bids...
>> INFO  - bidsSent                       - Exchange[BodyType:[B, Body:<?xml
>> version='1.0'
>> encoding='UTF-8'?><list><org.apache.servicemix.tutorial.camel.Bid><price>123.45</price><day>2008-11-04
>> 14:10:07.456 EST</day><location>some
>> location</location></org.apache.servicemix.tutorial.camel.Bid></list>]
>> INFO  - bidsRcvd                       -
>> Exchange[BodyType:org.apache.servicemix.jbi.jaxp.StringSource,
>> Body:<list><org.apache.servicemix.tutorial.camel.Bid><price>123.45</price><day>2008-11-04
>> 14:10:07.456 EST</day><location>some
>> location</location></org.apache.servicemix.tutorial.camel.Bid></list>]
>> Bid persistence called.
>> Bid list is null!!
>> 
>> (the last two lines are sys.outs from my 'persistence' service.)
>> 
>> If I try to pass the unmarshaled message on to a logger I get an NPE:
>> 
>> 
>> ERROR - DeadLetterChannel              - Failed delivery for exchangeId:
>> ID-tnichols-server/38614-1225825724466/0-0. On delivery attempt: 0
>> caught:
>> java.lang.NullPointerException
>> java.lang.NullPointerException
>>         at
>> org.apache.camel.component.log.LogFormatter.getBodyTypeAsString(LogFormatter.java:167)
>>         at
>> org.apache.camel.component.log.LogFormatter.format(LogFormatter.java:56)
>>         at org.apache.camel.processor.Logger.logMessage(Logger.java:218)
>>         at org.apache.camel.processor.Logger.process(Logger.java:88)
>>         at
>> org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:92)
>>         at
>> org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:66)
>>         at
>> org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:43)
>>         at
>> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:75)
>>         at
>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:57)
>>         at
>> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:155)
>>         at
>> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:91)
>>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
>>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:85)
>>         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.CamelJbiEndpoint.handleActiveProviderExchange(CamelJbiEndpoint.java:94)
>>  
>> 
>> Thanks again!
>> 
>> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/POJO-services-using-Serializable-objects-as-messages-tp20311335s22882p20426846.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message