You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Francois Lefoll <fr...@racinegroup.com> on 2010/06/21 15:47:21 UTC

camel-activemq unable to serialize Body after camel-exec usage

Hi,

I got a simple testcase: activemq->exec->activemq.

as exec, I will only use /bin/more (ie: copy stdin into stdout...)

this fails :
<camel:route>
<camel:from uri="activemq:queue:queue1"/>
<camel:to uri="exec:/bin/more"/>
<camel:to uri="log:myLogger"/>
<camel:to uri="activemq:queue:queue2"/>
</camel:route>

Jun 21, 2010 3:35:35 PM org.apache.camel.component.exec.ExecProducer process
INFO: Executing ExecCommand [args=[], executable=/bin/more,
timeout=9223372036854775807, outFile=null, workingDir=null,
useStderrOnEmptyStdout=false]
Jun 21, 2010 3:35:36 PM org.apache.camel.component.exec.ExecProducer process
INFO: The command ExecCommand [args=[], executable=/bin/more,
timeout=9223372036854775807, outFile=null, workingDir=null,
useStderrOnEmptyStdout=false] had exit value 0
Jun 21, 2010 3:35:36 PM org.apache.camel.processor.Logger process
INFO: Exchange[ExchangePattern:InOnly,
BodyType:org.apache.camel.component.exec.ExecResult, Body:<emptyMessage/>]
Jun 21, 2010 3:35:36 PM org.apache.camel.processor.Logger log
SEVERE: Failed delivery for exchangeId:
ID:user-laptop-44928-1277111283287-2:10:1:1:31. Exhausted after delivery
attempt: 1 caught: java.lang.RuntimeException: java.io.ByteArrayInputStream
java.lang.RuntimeException: java.io.ByteArrayInputStream
	at
org.apache.activemq.command.ActiveMQObjectMessage.storeContent(ActiveMQObjectMessage.java:104)
	at
org.apache.activemq.command.ActiveMQObjectMessage.setObject(ActiveMQObjectMessage.java:155)
	at
org.apache.activemq.ActiveMQSession.createObjectMessage(ActiveMQSession.java:378)
	at
org.apache.activemq.pool.PooledSession.createObjectMessage(PooledSession.java:153)
...
Caused by: java.io.NotSerializableException: java.io.ByteArrayInputStream
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
	at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
...
Did I miss something ?

Thanks for your help,
Regards,

Francois
-- 
View this message in context: http://camel.465427.n5.nabble.com/camel-activemq-unable-to-serialize-Body-after-camel-exec-usage-tp510418p510418.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-activemq unable to serialize Body after camel-exec usage

Posted by Francois Lefoll <fr...@racinegroup.com>.
Indeed, adding convertBodyTo makes it works, even under Jetty.
The fact config may be slightly Tomcat/Jetty dependent is little bit
surprising.

In any case, great thanks for this work around.

Best regards,

Francois

-- 
View this message in context: http://camel.465427.n5.nabble.com/camel-activemq-unable-to-serialize-Body-after-camel-exec-usage-tp510418p510438.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-activemq unable to serialize Body after camel-exec usage

Posted by mi...@icw.de.
Hi Francois, 
Did you try the following:


<camel:route>
<camel:from uri="activemq:queue:queue1"/>
<camel:to uri="exec:/bin/more"/>

<camel:convertBodyTo type="java.lang.String"/>

<camel:to uri="log:myLogger"/>
<camel:to uri="activemq:queue:queue2"/>
</camel:route>


and / or


<camel:route>
<camel:from uri="activemq:queue:queue1"/>
<camel:to uri="exec:/bin/more"/>
<camel:to uri="log:myLogger"/>

<camel:convertBodyTo type="java.lang.String"/>

<camel:to uri="activemq:queue:queue2"/>
</camel:route>


Regards, 
Mitko






From:
Francois Lefoll <fr...@racinegroup.com>
To:
users@camel.apache.org
Date:
21.06.2010 16:39
Subject:
Re: camel-activemq unable to serialize Body after camel-exec usage




Hi Mitko,

Unfortunately, the error is not due to the log action,
Same issue without the log, same issue reading (xml) result from an
outFile...
camel-activemq seems unable to read a Body passed by a camel-exec.
I say "seems", because,
I get this error below jetty-6.1.9, but testing under tomcat-6.0.26, I 
don't
get such error....

>From my window, it really look to be a bug.

Regards,

Francois
-- 
View this message in context: 
http://camel.465427.n5.nabble.com/camel-activemq-unable-to-serialize-Body-after-camel-exec-usage-tp510418p510428.html

Sent from the Camel - Users mailing list archive at Nabble.com.





InterComponentWare AG:  
Vorstand: Peter Kirschbauer (Vors.), J�rg Stadler / Aufsichtsratsvors.: Prof. Dr. Christof Hettich  
Firmensitz: 69190 Walldorf, Altrottstra�e 31 / AG Mannheim HRB 351761 / USt.-IdNr.: DE 198388516  

Re: camel-activemq unable to serialize Body after camel-exec usage

Posted by Francois Lefoll <fr...@racinegroup.com>.
Hi Mitko,

Unfortunately, the error is not due to the log action,
Same issue without the log, same issue reading (xml) result from an
outFile...
camel-activemq seems unable to read a Body passed by a camel-exec.
I say "seems", because,
I get this error below jetty-6.1.9, but testing under tomcat-6.0.26, I don't
get such error....

>From my window, it really look to be a bug.

Regards,

Francois
-- 
View this message in context: http://camel.465427.n5.nabble.com/camel-activemq-unable-to-serialize-Body-after-camel-exec-usage-tp510418p510428.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-activemq unable to serialize Body after camel-exec usage

Posted by mi...@icw.de.
Hi, 

try to convert the body to something that implements serializable (e.g. 
String), after the log endpoint. It seems that the log endpoint converts 
the body to a ByteArrayInputStream, which is not serializable. 

Regards, 
Mitko








From:
Francois Lefoll <fr...@racinegroup.com>
To:
users@camel.apache.org
Date:
21.06.2010 15:47
Subject:
camel-activemq unable to serialize Body after camel-exec usage




Hi,

I got a simple testcase: activemq->exec->activemq.

as exec, I will only use /bin/more (ie: copy stdin into stdout...)

this fails :
<camel:route>
<camel:from uri="activemq:queue:queue1"/>
<camel:to uri="exec:/bin/more"/>
<camel:to uri="log:myLogger"/>
<camel:to uri="activemq:queue:queue2"/>
</camel:route>

Jun 21, 2010 3:35:35 PM org.apache.camel.component.exec.ExecProducer 
process
INFO: Executing ExecCommand [args=[], executable=/bin/more,
timeout=9223372036854775807, outFile=null, workingDir=null,
useStderrOnEmptyStdout=false]
Jun 21, 2010 3:35:36 PM org.apache.camel.component.exec.ExecProducer 
process
INFO: The command ExecCommand [args=[], executable=/bin/more,
timeout=9223372036854775807, outFile=null, workingDir=null,
useStderrOnEmptyStdout=false] had exit value 0
Jun 21, 2010 3:35:36 PM org.apache.camel.processor.Logger process
INFO: Exchange[ExchangePattern:InOnly,
BodyType:org.apache.camel.component.exec.ExecResult, Body:<emptyMessage/>]
Jun 21, 2010 3:35:36 PM org.apache.camel.processor.Logger log
SEVERE: Failed delivery for exchangeId:
ID:user-laptop-44928-1277111283287-2:10:1:1:31. Exhausted after delivery
attempt: 1 caught: java.lang.RuntimeException: 
java.io.ByteArrayInputStream
java.lang.RuntimeException: java.io.ByteArrayInputStream
                 at
org.apache.activemq.command.ActiveMQObjectMessage.storeContent(ActiveMQObjectMessage.java:104)
                 at
org.apache.activemq.command.ActiveMQObjectMessage.setObject(ActiveMQObjectMessage.java:155)
                 at
org.apache.activemq.ActiveMQSession.createObjectMessage(ActiveMQSession.java:378)
                 at
org.apache.activemq.pool.PooledSession.createObjectMessage(PooledSession.java:153)
...
Caused by: java.io.NotSerializableException: java.io.ByteArrayInputStream
                 at 
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
                 at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
...
Did I miss something ?

Thanks for your help,
Regards,

Francois
-- 
View this message in context: 
http://camel.465427.n5.nabble.com/camel-activemq-unable-to-serialize-Body-after-camel-exec-usage-tp510418p510418.html

Sent from the Camel - Users mailing list archive at Nabble.com.





InterComponentWare AG:  
Vorstand: Peter Kirschbauer (Vors.), J�rg Stadler / Aufsichtsratsvors.: Prof. Dr. Christof Hettich  
Firmensitz: 69190 Walldorf, Altrottstra�e 31 / AG Mannheim HRB 351761 / USt.-IdNr.: DE 198388516