You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Chuck Adams (JIRA)" <ji...@apache.org> on 2010/04/30 17:57:34 UTC
[jira] Commented: (CAMEL-2687) exec component fails after receiving
empty output
[ https://issues.apache.org/activemq/browse/CAMEL-2687?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=59178#action_59178 ]
Chuck Adams commented on CAMEL-2687:
------------------------------------
I see JIRA ate my source code. Here's the relevant body of the .configure() method
{quote}
from("timer://foo?period=5000")
.to("exec:C:/apps/putty/PLINK.EXE?args=cadams@labmachine -i C:/apps/putty/priv/chuck.ppk "\"ls /tmp/foo\"")
.to("log:bizint.cameltest");
{quote}
> exec component fails after receiving empty output
> -------------------------------------------------
>
> Key: CAMEL-2687
> URL: https://issues.apache.org/activemq/browse/CAMEL-2687
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-core
> Affects Versions: 2.3.0
> Environment: windows XP, jdk 1.6
> Reporter: Chuck Adams
>
> I have a simple route here:
> {quote}
> public void configure() {
> from("timer://foo?period=5000")
> .to("C:/apps/putty/PLINK.EXE?args=cadams@labmachine -i C:/apps/putty/priv/chuck.ppk \"ls /tmp/foo\"")
> .to("log:experiments.cameltest");
> }
> {quote}
> This just runs a dummy command on a remote machine every five seconds. Normally it has no problems as long as /tmp/foo has contents. For example, I create 'bar' and 'baz' files, and the log reflects this:
> {quote}
> [ main] DefaultCamelContext INFO Apache Camel 2.3-SNAPSHOT (CamelContext: camelContext) started in 734 millis
> [ foo] ExecProducer INFO Executing ExecCommand [args=[cadams@labmachine, -i, C:/apps/putty/priv/chuck.ppk, ls /tmp/foo], executable=C:/apps/putty/PLINK.EXE, timeout=9223372036854775807, outFile=null, workingDir=null]
> [ foo] ExecProducer INFO The command ExecCommand [args=[cadams@labmachine, -i, C:/apps/putty/priv/chuck.ppk, ls /tmp/foo], executable=C:/apps/putty/PLINK.EXE, timeout=9223372036854775807, outFile=null, workingDir=null] had exit value 0
> [ foo] cameltest INFO Exchange[ExchangePattern:InOnly, BodyType:org.apache.camel.component.exec.ExecResult, Body:bar
> baz
> blah
> ]
> [ foo] ExecProducer INFO Executing ExecCommand [args=[cadams@spamlab-bizintel-corpus01.eng.symantec.com, -i, C:/apps/putty/priv/chuck.ppk, ls /tmp/foo], executable=C:/apps/putty/PLINK.EXE, timeout=9223372036854775807, outFile=null, workingDir=null]
> [ foo] ExecProducer INFO The command ExecCommand [args=[cadams@spamlab-bizintel-corpus01.eng.symantec.com, -i, C:/apps/putty/priv/chuck.ppk, ls /tmp/foo], executable=C:/apps/putty/PLINK.EXE, timeout=9223372036854775807, outFile=null, workingDir=null] had exit value 0
> [ foo] cameltest INFO Exchange[ExchangePattern:InOnly, BodyType:org.apache.camel.component.exec.ExecResult, Body:bar
> baz
> blah
> ]
> {quote}
> And so on.... But if I delete both files, this is what happens:
> {quote}
> [ foo] ExecProducer INFO Executing ExecCommand [args=[cadams@labmachine, -i, C:/apps/putty/priv/chuck.ppk, ls /tmp/foo], executable=C:/apps/putty/PLINK.EXE, timeout=9223372036854775807, outFile=null, workingDir=null]
> [ foo] ExecProducer INFO The command ExecCommand [args=[cadams@labmachine, -i, C:/apps/putty/priv/chuck.ppk, ls /tmp/foo], executable=C:/apps/putty/PLINK.EXE, timeout=9223372036854775807, outFile=null, workingDir=null] had exit value 0
> [ foo] ExecResultConverter WARN Received null stdout of the ExecResult for conversion!
> [ foo] DefaultTypeConverter WARN Overriding type converter from: StaticMethodTypeConverter: public static java.lang.String org.apache.camel.component.exec.ExecResultConverter.convertToString(org.apache.camel.component.exec.ExecResult,org.apache.camel.Exchange) throws java.io.FileNotFoundException to: org.apache.camel.impl.converter.ToStringTypeConverter@1e3d24a
> [ foo] cameltest INFO Exchange[ExchangePattern:InOnly, BodyType:org.apache.camel.component.exec.ExecResult, Body:org.apache.camel.component.exec.ExecResult@d767dc]
> {quote}
> And from that point on, even if I add files to the directory again, I get nothing back, just the following log section over and over. It seems that the behavior of suddenly switching the converter to ToStringTypeConverter had the effect of suppressing all output for good.
> {quote}
> [ foo] ExecProducer INFO Executing ExecCommand [args=[cadams@labmachine, -i, C:/apps/putty/priv/chuck.ppk, ls /tmp/foo], executable=C:/apps/putty/PLINK.EXE, timeout=9223372036854775807, outFile=null, workingDir=null]
> [ foo] ExecProducer INFO The command ExecCommand [args=[cadams@labmachine, -i, C:/apps/putty/priv/chuck.ppk, ls /tmp/foo], executable=C:/apps/putty/PLINK.EXE, timeout=9223372036854775807, outFile=null, workingDir=null] had exit value 0
> [ foo] cameltest INFO Exchange[ExchangePattern:InOnly, BodyType:org.apache.camel.component.exec.ExecResult, Body:org.apache.camel.component.exec.ExecResult@3aacb4]
> {quote}
> This behavior is certainly unexpected and undesireable. I've been working around this by making my remote script always produce some dummy output when they otherwise have nothing to return, but any workaround I could use on the Camel side pending a more permanent fix would be very much appreciated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.