camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tide08 <sachin2...@yahoo.com>
Subject Re: DataSet header {CamelDataSetIndex=0} causes failure
Date Tue, 24 Nov 2009 00:54:58 GMT

So looks like CaseInsensitiveMap is not serializable :( 

Map.Entry is non-serializable and so java.util.HashMap defines those as
transient so that serialization of that member does not happen. So
CaseInsenstiveMap should also define its member "entrySetView" as transient
or if it needs to be serialized CaseInsenstiveMap should implement
writeObject()/readObject().

Here is the unit test which fails on serialization:

@Test
    public void testInsensitiveMapSerialization() throws IOException,
ClassNotFoundException {
        CaseInsensitiveMap testMap = new CaseInsensitiveMap();
        testMap.put("key", "value");
        testMap.entrySet();

        ByteArrayOutputStream bStream = new ByteArrayOutputStream();

        ObjectOutputStream objStream = new ObjectOutputStream(bStream);
        objStream.writeObject(testMap);

        ObjectInputStream inStream = new ObjectInputStream(new
ByteArrayInputStream(bStream.toByteArray()));
        CaseInsensitiveMap testMapCopy = (CaseInsensitiveMap)
inStream.readObject();

        Assert.assertTrue(testMapCopy.containsKey("key"));
    }



tide08 wrote:
> 
> I have soak test with following route and it seems to fail with following
> error. I am using camel 2.1-SNAPSHOT.
> 
> I am not sure why that happens -
> 
> <route>
> 	    <from uri="dataset:messageDataSet?produceDelay=10"/>
> 	    <to uri="proxySender" />
> </route>
> <route>
> 	    <from uri="activemq:testQueue"/>
> 	    <to uri="dataset:messageDataSet?produceDelay=10"/>
> </route>
> 
> ProxySender instead is just a custom processor which uses camelTemplate
> and camel-jms to send message to "activemq:testQueue" on a standalone
> broker.
> 
> I tried using the proxySender without using DataSet and it seems to work
> just fine. But when used with DataSet it seems to fail while storing
> message (ActiveMQObjectMessage.storeContent() ) - DataSet header
> {CamelDataSetIndex=0}. CaseInsensitiveMap fails to serialize?
> 
> Any ideas on what may be wrong?
> 
> Thread Stack:
> 
> Daemon Thread [Camel thread 0: DataSetComponent] (Suspended)	
> 	ActiveMQObjectMessage.storeContent() line: 104	
> 	ActiveMQObjectMessage.setObject(Serializable) line: 155	
> 	ActiveMQSession.createObjectMessage(Serializable) line: 325	
> 	PooledSession.createObjectMessage(Serializable) line: 149	
> 	JmsBinding.createJmsMessage(Exchange, Object, Map<String,Object>,
> Session, CamelContext) line: 489	
> 	JmsBinding.makeJmsMessage(Exchange, Message, Session, Exception) line:
> 277	
> 	JmsProducer$2.createMessage(Session) line: 316	
> 	JmsConfiguration$CamelJmsTemplate.doSendToDestination(Destination,
> MessageCreator, JmsConfiguration$MessageSentCallback, Session) line: 221	
> 
> JmsConfiguration$CamelJmsTemplate.access$100(JmsConfiguration$CamelJmsTemplate,
> Destination, MessageCreator, JmsConfiguration$MessageSentCallback,
> Session) line: 164	
> 	JmsConfiguration$CamelJmsTemplate$3.doInJms(Session) line: 198	
> 	JmsConfiguration$CamelJmsTemplate(JmsTemplate).execute(SessionCallback,
> boolean) line: 471	
> 	JmsConfiguration$CamelJmsTemplate.send(String, MessageCreator) line: 195	
> 	JmsProducer.doSend(boolean, String, Destination, MessageCreator,
> DeferredRequestReplyMap$DeferredMessageSentCallback) line: 375	
> 	JmsProducer.processInOnly(Exchange) line: 320	
> 	JmsProducer.process(Exchange) line: 150	
> 	ProducerCache$1.doInProducer(Producer, Exchange, ExchangePattern) line:
> 179	
> 	ProducerCache$1.doInProducer(Producer, Exchange, ExchangePattern) line:
> 161	
> 	ProducerCache.doInProducer(Endpoint, Exchange, ExchangePattern,
> ProducerCallback<T>) line: 146	
> 	ProducerCache.sendExchange(Endpoint, ExchangePattern, Processor,
> Exchange) line: 160	
> 	ProducerCache.send(Endpoint, Processor) line: 98	
> 	DefaultProducerTemplate.send(Endpoint, Processor) line: 97	
> 	DefaultProducerTemplate.sendBodyAndHeaders(Endpoint, Object,
> Map<String,Object>) line: 206	
> 	DefaultProducerTemplate.sendBodyAndHeaders(String, Object,
> Map<String,Object>) line: 202	
> 	JmsMessageServiceImpl.send(Message...) line: 60	
> 	ProxySendProcessor.process(Exchange) line: 17	
> 	ProcessorEndpoint.onExchange(Exchange) line: 95	
> 	ProcessorEndpoint$1.process(Exchange) line: 65	
> 	SendProcessor$1.doInProducer(Producer, Exchange, ExchangePattern) line:
> 97	
> 	SendProcessor$1.doInProducer(Producer, Exchange, ExchangePattern) line:
> 95	
> 	ProducerCache.doInProducer(Endpoint, Exchange, ExchangePattern,
> ProducerCallback<T>) line: 146	
> 	SendProcessor.doProcess(Exchange) line: 94	
> 	SendProcessor.process(Exchange) line: 82	
> 	InstrumentationProcessor.process(Exchange) line: 67	
> 	TraceInterceptor(DelegateProcessor).processNext(Exchange) line: 53	
> 	TraceInterceptor(DelegateProcessor).proceed(Exchange) line: 82	
> 	TraceInterceptor.process(Exchange) line: 93	
> 	InstrumentationProcessor.process(Exchange) line: 67	
> 	DefaultErrorHandler(RedeliveryErrorHandler).processExchange(Exchange)
> line: 223	
> 	DefaultErrorHandler(RedeliveryErrorHandler).processErrorHandler(Exchange,
> RedeliveryErrorHandler$RedeliveryData) line: 153	
> 	DefaultErrorHandler(RedeliveryErrorHandler).process(Exchange) line: 91	
> 	DefaultErrorHandler.process(Exchange) line: 49	
> 	DefaultChannel.process(Exchange) line: 206	
> 	UnitOfWorkProcessor.processNext(Exchange) line: 54	
> 	UnitOfWorkProcessor(DelegateProcessor).process(Exchange) line: 48	
> 	InstrumentationProcessor.process(Exchange) line: 67	
> 	DataSetConsumer.sendMessages(long, long) line: 70	
> 	DataSetConsumer$1.run() line: 61	
> 	Executors$RunnableAdapter<T>.call() line: 441	
> 	FutureTask$Sync.innerRun() line: 303	
> 	ScheduledThreadPoolExecutor$ScheduledFutureTask<V>(FutureTask<V>).run()
> line: 138	
> 
> ScheduledThreadPoolExecutor$ScheduledFutureTask<V>.access$301(ScheduledThreadPoolExecutor$ScheduledFutureTask)
> line: 98	
> 	ScheduledThreadPoolExecutor$ScheduledFutureTask<V>.run() line: 207	
> 	ThreadPoolExecutor$Worker.runTask(Runnable) line: 886	
> 	ThreadPoolExecutor$Worker.run() line: 908	
> 	Thread.run() line: 637	
> 
> 
> Error StackTrace:
> 
> [java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156),
> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326),
> java.util.HashSet.writeObject(HashSet.java:267),
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method),
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39),
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25),
> java.lang.reflect.Method.invoke(Method.java:597),
> java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945),
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461),
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392),
> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150),
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509),
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474),
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392),
> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150),
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509),
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474),
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392),
> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150),
> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326),
> org.apache.activemq.command.ActiveMQObjectMessage.storeContent(ActiveMQObjectMessage.java:98),
> org.apache.activemq.command.ActiveMQObjectMessage.setObject(ActiveMQObjectMessage.java:155),
> org.apache.activemq.ActiveMQSession.createObjectMessage(ActiveMQSession.java:325),
> org.apache.activemq.pool.PooledSession.createObjectMessage(PooledSession.java:149),
> org.apache.camel.component.jms.JmsBinding.createJmsMessage(JmsBinding.java:489),
> org.apache.camel.component.jms.JmsBinding.makeJmsMessage(JmsBinding.java:277),
> org.apache.camel.component.jms.JmsProducer$2.createMessage(JmsProducer.java:316),
> org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.doSendToDestination(JmsConfiguration.java:221),
> org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.access$100(JmsConfiguration.java:164),
> org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate$3.doInJms(JmsConfiguration.java:198),
> org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:471),
> org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:195),
> org.apache.camel.component.jms.JmsProducer.doSend(JmsProducer.java:375),
> org.apache.camel.component.jms.JmsProducer.processInOnly(JmsProducer.java:320),
> org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:150),
> org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:179),
> org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:161),
> org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146),
> org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:160),
> org.apache.camel.impl.ProducerCache.send(ProducerCache.java:98),
> org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:97),
> org.apache.camel.impl.DefaultProducerTemplate.sendBodyAndHeaders(DefaultProducerTemplate.java:206),
> org.apache.camel.impl.DefaultProducerTemplate.sendBodyAndHeaders(DefaultProducerTemplate.java:202),
> com.citrix.message.service.jms.JmsMessageServiceImpl.send(JmsMessageServiceImpl.java:60),
> com.citrix.message.ProxySendProcessor.process(ProxySendProcessor.java:17),
> org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:95),
> org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:65),
> org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:97),
> org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:95),
> org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146),
> org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:94),
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:82),
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67),
> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53),
> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82),
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:93),
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67),
> org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:223),
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:153),
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:91),
> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49),
> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206),
> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54),
> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48),
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67),
> org.apache.camel.component.dataset.DataSetConsumer.sendMessages(DataSetConsumer.java:70),
> org.apache.camel.component.dataset.DataSetConsumer$1.run(DataSetConsumer.java:61),
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441),
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303),
> java.util.concurrent.FutureTask.run(FutureTask.java:138),
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98),
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207),
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886),
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908),
> java.lang.Thread.run(Thread.java:637)]
> 

-- 
View this message in context: http://old.nabble.com/DataSet-header-%7BCamelDataSetIndex%3D0%7D-causes-failure-tp26487985p26488848.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message