From user-return-24422-apmail-commons-user-archive=commons.apache.org@commons.apache.org Mon Apr 26 12:16:40 2010 Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 28277 invoked from network); 26 Apr 2010 12:16:40 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 26 Apr 2010 12:16:40 -0000 Received: (qmail 90235 invoked by uid 500); 26 Apr 2010 12:16:39 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 90086 invoked by uid 500); 26 Apr 2010 12:16:38 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 90078 invoked by uid 99); 26 Apr 2010 12:16:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Apr 2010 12:16:38 +0000 X-ASF-Spam-Status: No, hits=-0.4 required=10.0 tests=AWL,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sebbaz@gmail.com designates 209.85.218.210 as permitted sender) Received: from [209.85.218.210] (HELO mail-bw0-f210.google.com) (209.85.218.210) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Apr 2010 12:16:33 +0000 Received: by bwz2 with SMTP id 2so7220986bwz.10 for ; Mon, 26 Apr 2010 05:16:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=B2FjR7ciLr4lvzbgEr5wtSafzDacrnL2ILqoaAOvXcg=; b=AOtKLMMJzBoJKvUivVSHwp4X7uxD6wLDvBP3NmDCMjLuItmSeRbHQ4Ao18CPZf22fD CtGAQyT4zDxQeXRg44rxvwrMh8Kxg2bKfYDSTHe/PDAXE84OwtDg+inhJSDsswpoObzc 6YFjSao8015A3M5TxR45YtACZZVOa9v1/p+qk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=pHRwbhVPRpPZIQcyLNXZ1JMJattuLRFrUpK9OxOSLr5ujtdlxMnz/7bhzRbJ3cQDy2 tjDbMBt2ziRdCaIOA82gCnx0LXX7xCYDlJkuevaca96k4vxwX9jeqjvTgZ1OPTIBYIaO 6iXUslrm92ODoQtw1+QcIW7uugLPUAKmu5lfc= MIME-Version: 1.0 Received: by 10.239.160.19 with SMTP id a19mr408597hbd.165.1272284171200; Mon, 26 Apr 2010 05:16:11 -0700 (PDT) Received: by 10.239.173.67 with HTTP; Mon, 26 Apr 2010 05:16:10 -0700 (PDT) In-Reply-To: References: <4BCC8D37.5070200@it20one.at> Date: Mon, 26 Apr 2010 13:16:10 +0100 Message-ID: Subject: Re: Commons Exec not producing the same result as the command line From: sebb To: Commons Users List Cc: daolwin@hotmail.com Content-Type: text/plain; charset=ISO-8859-1 On 26/04/2010, Daniel Wamara wrote: > Yes, I happened to sort it out, thanks. What was the resolution please? Just in case anyone else hits the same problem, it would be useful to have the solution in the mail archives. > Daniel > > -------------------------------------------------- > From: "Siegfried Goeschl" > Sent: Monday, April 19, 2010 7:04 PM > > To: "Commons Users List" > Subject: Re: Commons Exec not producing the same result as the command line > > > > Hi Daniel, > > > > any progress and/or information regarding your problem? > > > > Cheers, > > > > Siegfried Goeschl > > > > On 14.04.10 11:54, Daniel Wamara wrote: > > > > > I did make a wrapper, that's the script I am calling from the exec and > > > even calling the wrapper through exec, I get the same thing I get when I > > > use no wrapper. It's very unlikely that another application is picked up > > > as it is the only instance of the application installed on the server (a > > > Red Hat EL 3). > > > > > > Daniel > > > > > > -------------------------------------------------- > > > From: "sebb" > > > Sent: Wednesday, April 14, 2010 11:46 AM > > > To: "Commons Users List" > > > Subject: Re: Commons Exec not producing the same result as the command > line > > > > > > > > > > On 14/04/2010, Daniel Wamara wrote: > > > > > > > > > Very unlikely IMO because they both call an external process which > has > > > > > nothing to do with Java and if there was some kind of problem with > > > > > the path, > > > > > I think the external process would have thrown an error of some > kind. > > > > > > > > > > > > > If the PATH is different, it may pick up a different application. > > > > > > > > Do other Exec calls work OK? > > > > > > > > Try creating a wrapper shell script with no parameters. > > > > Call that interactively and from Exec. > > > > Add debug echo statements as necessary to determine what is happening. > > > > > > > > > > > > > Regards, > > > > > Daniel W. > > > > > > > > > > -------------------------------------------------- > > > > > From: "sebb" > > > > > Sent: Wednesday, April 14, 2010 11:36 AM > > > > > > > > > > To: "Commons Users List" > > > > > Subject: Re: Commons Exec not producing the same result as the > > > > > command line > > > > > > > > > > > > > > > > On 14/04/2010, sebb wrote: > > > > > > > > > > > > > On 14/04/2010, Daniel Wamara wrote: > > > > > > > > Thanks but I don't think this will help solve the problem as I > > > > can > > > > > see in > > > > > > > > the log that the command which is executed is the correct one > > > > > and > > as > > > > > said, > > > > > > > > copy-pasting the command seen in the logs is producing a file > > > > > completely > > > > > > > > different than the one created by Commons Exec. > > > > > > > > > > > > > > > > > > > > > Then the two invocations are most likely using different > > > > > classpaths > > at > > > > > > > some point. > > > > > > > > > > > > > > > > > > > ... I mean PATHs. > > > > > > > > > > > > > > > > > > > > > > > > > > > Regards, > > > > > > > > Daniel W. > > > > > > > > > > > > > > > > > -------------------------------------------------- > > > > > > > > From: "sebb" > > > > > > > > Sent: Wednesday, April 14, 2010 1:18 AM > > > > > > > > To: "Commons Users List" > > > > > > > > Subject: Re: Commons Exec not producing the same result as the > > > > > command line > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On 13/04/2010, Daniel Wamara wrote: > > > > > > > > > > > > > > > > > > > Good evening all, > > > > > > > > > > > > > > > > > > > > I am trying to call ffmpeg via the command exec in order > to > > > > > transcode > > > > > > > > some files and the strange thing happening is that the files > > > > > > > produced > > > > > are > > > > > > > > not the same as the one I can create when calling the same > > > > command > > > > > via the > > > > > > > > command line. > > > > > > > > > > > > > > > > > > > > This is how I am calling fmpeg and I get a file with a > > > > > particular codec > > > > > > > > in it (strangely not the right one) although launching in the > > > > > > > > command > > > > > line > > > > > > > > exactly what I have in the sb.toString() which is the command > > > > > to > > be > > > > > > > > executed, the file created has a correct codec. So to say, the > > > > > > > same > > > > > command > > > > > > > > started via Exec and the one started via the command line have > > > > not > > > > > the same > > > > > > > > result. Anyone has an idea? > > > > > > > > > > > > > > > > > > > > Thanks. > > > > > > > > > > Daniel Wamara > > > > > > > > > > > > > > > > > > > > StringBuilder sb = new > > > > > > > > > StringBuilder("/home/ect/scripts/transcoding.sh "); > > > > > > > > > > > > > > > > > > > > sb.append(" " + source.getAbsolutePath()); > > > > > > > > > > > > > > > > > > > > sb.append(" " + attributes.getCodec()); > > > > > > > > > > > > > > > > > > > > sb.append(" " + > > > > > > > > > > > > > > String.valueOf(attributes.getSamplingRate().intValue())); > > > > > > > > > > > > > > > > > > > > sb.append(" " + target.getAbsolutePath()); > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > logDebug("command --> " + sb.toString()); > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > CommandLine commandLine = > > > > > > > > CommandLine.parse(sb.toString()); > > > > > > > > > > > > > > > > > > > > > > > > > > > > Why do you build up the command-line and then parse it? > > > > > > > > > > > > > > > > > > Much safer to add the arguments one at a time, see: > > > > > > > > > > > > > > > > > > > http://commons.apache.org/exec/tutorial.html > > > > > > > > > > > > > > > > > > under the heading "Build the Command Line Incrementally" > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > DefaultExecutor executor = new DefaultExecutor(); > > > > > > > > > > > > > > > > > > > > executor.execute(commandLine); > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > > > > > To unsubscribe, e-mail: > > > > > > > > user-unsubscribe@commons.apache.org > > > > > > > > > For additional commands, e-mail: > user-help@commons.apache.org > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > > > > To unsubscribe, e-mail: > > > > > > > > user-unsubscribe@commons.apache.org > > > > > > > > For additional commands, e-mail: user-help@commons.apache.org > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > > To unsubscribe, e-mail: > > > > > user-unsubscribe@commons.apache.org > > > > > > For additional commands, e-mail: user-help@commons.apache.org > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > To unsubscribe, e-mail: > > > > > user-unsubscribe@commons.apache.org > > > > > For additional commands, e-mail: user-help@commons.apache.org > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: > user-unsubscribe@commons.apache.org > > > > For additional commands, e-mail: user-help@commons.apache.org > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: > user-unsubscribe@commons.apache.org > > > For additional commands, e-mail: user-help@commons.apache.org > > > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > user-unsubscribe@commons.apache.org > > For additional commands, e-mail: user-help@commons.apache.org > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > user-unsubscribe@commons.apache.org > For additional commands, e-mail: user-help@commons.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org