Try adding a .convertBodyTo(String.class) just after the .marshal(jackson)
and before the MongoDB endpoint.

Regards,

*Raúl Kripalani*
Apache Camel Committer
Enterprise Architect, Program Manager, Open Source Integration specialist
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk <http://twitter.com/raulvk>

On Thu, Feb 14, 2013 at 6:01 PM, Ron Anderson <biker_...@yahoo.com> wrote:

> Hi Raul,
>
> Thanks for your helpful suggestion.  I'm having an issue though that I
> can't
> seem to figure out and wondering if you have any ideas.
>
> Trying your suggestion I've set up the DataFormat as:
> ObjectMapper objectMapper = new ObjectMapper();
>
> objectMapper.disable(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS);
> JacksonDataFormat jackson = new JacksonDataFormat(objectMapper, null);
>
> And applied it to the marshaller as:
>
> from("activemq:queue:incomingRecords")
> .routeId("record_processor")
> .marshal(jackson)
>
> .to("mongodb:mongoConn?database=usage&collection=lteusage&operation=insert")
> .end();
>
> But I'm getting the following exception that does not occur when I remove
> the marshaller and just let mongodb component do the marshalling.
>
> Hoping you might have some ideas as to what might be causing this.  My pojo
> is very simple Strings, Integers and Date.
>
> Caused by: org.apache.camel.NoTypeConversionAvailableException: No type
> converter available to convert from type: java.lang.Byte to the required
> type: com.mongodb.DBObject with value 110
>
>         at
>
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:169)
>         at
>
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:142)
>         at
>
> org.apache.camel.component.mongodb.MongoDbProducer.attemptConvertToList(MongoDbProducer.java:419)
>         ... 49 more
> 2013-02-14 09:51:56,531 WARN  ~ Conversion has fallen back to generic
> Object
> -> DBObject, but unable to convert type
> org.apache.camel.component.jms.JmsMessage. Returning null.
>
> org.apache.camel.component.mongodb.CamelMongoDbException: MongoDB operation
> = insert, Assuming List variant of MongoDB insert operation, but List
> contains non-DBObject items
> org.apache.camel.component.mongodb.CamelMongoDbException: MongoDB operation
> = insert, Assuming List variant of MongoDB insert operation, but List
> contains non-DBObject items
>         at
>
> org.apache.camel.component.mongodb.MongoDbProducer.attemptConvertToList(MongoDbProducer.java:422)
>         at
>
> org.apache.camel.component.mongodb.MongoDbProducer.doInsert(MongoDbProducer.java:239)
>         at
>
> org.apache.camel.component.mongodb.MongoDbProducer.invokeOperation(MongoDbProducer.java:102)
>         at
>
> org.apache.camel.component.mongodb.MongoDbProducer.process(MongoDbProducer.java:70)
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/MongoDB-Jackson-Date-Mapping-Option-tp5727548p5727625.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Reply via email to