You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Kai Kaisen <ka...@googlemail.com> on 2011/03/11 17:56:23 UTC

BSF Sampler - error on executing external app with blanks in path and name

Hi guys,
How to use the BSF Sampler with beanshell to execute an external application
which has blanks in its path and name?
I tried something like this:

exec("/Applications/Adobe\ Photoshop\ CS5/Adobe\ Photoshop\
CS5.app/Contents/MacOS/Adobe\ Photoshop\ CS5");

As you can see I am on a MAC. I know, the problems is caused by the blanks
in the path.I tried different ways to 'mark' them but nothing helped.
JMeter always throws an error:

...

2011/03/11 17:44:41 WARN  - jmeter.protocol.java.sampler.BSFSampler: BSF
error org.apache.bsf.BSFException: BeanShell script error: Sourced file:
inline evaluation of: ``exec("Applications/Adobe\ Photoshop\ CS5/Adobe\
Photoshop\ CS5.app/Contents/MacO . . . '' Token Parsing Error: Lexical error
at line 1, column 26.  Encountered: " " (32), after :
"\"Applications/Adobe\\": <at unknown location>

 BSF info: script at line: 0 column: columnNo

at bsh.util.BeanShellBSFEngine.eval(BeanShellBSFEngine.java:199)

at org.apache.jmeter.protocol.java.sampler.BSFSampler.sample(
BSFSampler.java:150)

at org.apache.jmeter.threads.JMeterThread.process_sampler(
JMeterThread.java:381)

at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:274)

at java.lang.Thread.run(Thread.java:680)


2011/03/11 17:44:42 INFO  - jmeter.threads.JMeterThread: Thread finished:
Thread Group 1-1
...

I also tried:
exec("/Applications/Adobe\\ Photoshop\\ CS5/Adobe\\ Photoshop\\
CS5.app/Contents/MacOS/Adobe\\ Photoshop\\ CS5");
exec("/Applications/Adobe Photoshop CS5/Adobe Photoshop
CS5.app/Contents/MacOS/Adobe Photoshop CS5");
exec("'/Applications/Adobe Photoshop CS5/Adobe Photoshop
CS5.app/Contents/MacOS/Adobe Photoshop CS5'");
Nothing helped.
A workaround is to call a script with a 'clean' name and use this to start
the app but...thats not cool.
Any ideas?
Thank you very much!
Kai

Re: BSF Sampler - error on executing external app with blanks in path and name

Posted by sebb <se...@gmail.com>.
On 11 March 2011 16:56, Kai Kaisen <ka...@googlemail.com> wrote:
> Hi guys,
> How to use the BSF Sampler with beanshell to execute an external application
> which has blanks in its path and name?
> I tried something like this:
>
> exec("/Applications/Adobe\ Photoshop\ CS5/Adobe\ Photoshop\
> CS5.app/Contents/MacOS/Adobe\ Photoshop\ CS5");

AFAICT, this is not really anything to do with BeanShell or JMeter.

The BSH exec() call uses Java Runtime exec() - I suggest you check the
documentation for that.
Google may help here.

> As you can see I am on a MAC. I know, the problems is caused by the blanks
> in the path.I tried different ways to 'mark' them but nothing helped.
> JMeter always throws an error:
>
> ...
>
> 2011/03/11 17:44:41 WARN  - jmeter.protocol.java.sampler.BSFSampler: BSF
> error org.apache.bsf.BSFException: BeanShell script error: Sourced file:
> inline evaluation of: ``exec("Applications/Adobe\ Photoshop\ CS5/Adobe\
> Photoshop\ CS5.app/Contents/MacO . . . '' Token Parsing Error: Lexical error
> at line 1, column 26.  Encountered: " " (32), after :
> "\"Applications/Adobe\\": <at unknown location>
>
>  BSF info: script at line: 0 column: columnNo
>
> at bsh.util.BeanShellBSFEngine.eval(BeanShellBSFEngine.java:199)
>
> at org.apache.jmeter.protocol.java.sampler.BSFSampler.sample(
> BSFSampler.java:150)
>
> at org.apache.jmeter.threads.JMeterThread.process_sampler(
> JMeterThread.java:381)
>
> at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:274)
>
> at java.lang.Thread.run(Thread.java:680)
>
>
> 2011/03/11 17:44:42 INFO  - jmeter.threads.JMeterThread: Thread finished:
> Thread Group 1-1
> ...
>
> I also tried:
> exec("/Applications/Adobe\\ Photoshop\\ CS5/Adobe\\ Photoshop\\
> CS5.app/Contents/MacOS/Adobe\\ Photoshop\\ CS5");
> exec("/Applications/Adobe Photoshop CS5/Adobe Photoshop
> CS5.app/Contents/MacOS/Adobe Photoshop CS5");
> exec("'/Applications/Adobe Photoshop CS5/Adobe Photoshop
> CS5.app/Contents/MacOS/Adobe Photoshop CS5'");
> Nothing helped.
> A workaround is to call a script with a 'clean' name and use this to start
> the app but...thats not cool.
> Any ideas?
> Thank you very much!
> Kai
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org