2016-01-22 79 views
0

我在Apache的駱駝配置了以下路線無法產生數據阿帕奇駱駝hazelcast

from("direct:hazelCast") 
     .setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.PUT_OPERATION)) 
     .toF("hazelcast:map:testHazel", HazelcastConstants.MAP_PREFIX); 

但是,當上述路線被調用,我發現了以下錯誤:

java.lang.NullPointerException: Null key is not allowed! 
at com.hazelcast.map.impl.proxy.MapProxyImpl.put(MapProxyImpl.java:95) 
at com.hazelcast.map.impl.proxy.MapProxyImpl.put(MapProxyImpl.java:89) 
at org.apache.camel.component.hazelcast.map.HazelcastMapProducer.put(HazelcastMapProducer.java:125) 
at org.apache.camel.component.hazelcast.map.HazelcastMapProducer.process(HazelcastMapProducer.java:60) 
at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) 
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:141) 
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77) 
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460) 
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190) 
at org.apache.camel.processor.Pipeline.process(Pipeline.java:121) 
at org.apache.camel.processor.Pipeline.process(Pipeline.java:83) 
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190) 
at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62) 
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:141) 
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77) 
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190) 
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460) 
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190) 
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109) 
at org.apache.camel.processor.MulticastProcessor.doProcessParallel(MulticastProcessor.java:814) 
at org.apache.camel.processor.MulticastProcessor.access$200(MulticastProcessor.java:84) 
at org.apache.camel.processor.MulticastProcessor$1.call(MulticastProcessor.java:314) 
at org.apache.camel.processor.MulticastProcessor$1.call(MulticastProcessor.java:299) 
at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
at java.lang.Thread.run(Thread.java:745) 

,我使用的代碼幾乎類似於在那裏是駱駝文檔http://camel.apache.org/hazelcast-component.html

以下是其產生的數據到h的代碼azelcast

The following is the code snippet that I have used to produce the data to hazelcast in camel: 

    from("direct:hazelCast") 
     .setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.PUT_OPERATION)) 
     .setHeader(HazelcastConstants.OBJECT_ID, constant("SOME BLA BLA")) 
     .split() 
     .tokenizeXML(<SOMEValidTag>).streaming() 
     .unmarshal(jaxb) 
     .convertBodyTo(<Valid>.class) 
     .marshal().json(JsonLibrary.Jackson) 
     .toF("hazelcast:%stestHazel", HazelcastConstants.MAP_PREFIX); 

注:我們需要將身體轉換成類,這是應該是可序列化

+0

更新與片斷工作的OBJECTID。 –

回答

1

您需要設置它缺少

+0

我應該在哪裏設置objectID?可能是一個愚蠢的問題。 –

+0

將其設置在標題中 – Sundar