You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Will McQueen <wi...@yahoo.com> on 2009/07/10 15:17:05 UTC

JMeter and Jython -- BSF Sampler not working for me

Hi,

I'm attempting to use JMeter 2.3.4 with Jython 2.5 (also tried Jython 2.2.1) running from WinXP. I created a standalone Jython jar (per Jython website's instrs), and placed it in JMeter's lib dir. I started with an empty test plan, and created a ThreadGroup and a BSF Sampler. From the drop-down menu, I chose the script language to be "jython". In the big text box at the bottom of the sampler, I wrote the jython command:

print 5

I then added a "View Results Tree" listener.  I ran this test plan, and got an error in the <Sampler result> tab of the listener:

Response code: 500
Response message: org.apache.bsf.BSFException: exception from Jython:
Traceback (innermost last):
  (no code object) at line 0
SyntaxError: ('invalid syntax', ('<string>', 1, 1, 'print 5'))

I've googled this but couldn't find any useful info or fix. Is this a bug?

By comparison, if I use a BSF Preprocessor or BSF Postprocessor (again specifying jython and "print 5"), then it works... it just doesn't work as a sampler.

Thank you.

Cheers,
Will

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: JMeter and Jython -- BSF Sampler not working for me

Posted by sebb <se...@gmail.com>.
On 27/07/2009, sebb <se...@gmail.com> wrote:
> On 10/07/2009, Will McQueen <wi...@yahoo.com> wrote:
>  >
>  >  Hi,
>  >
>  >  I'm attempting to use JMeter 2.3.4 with Jython 2.5 (also tried Jython 2.2.1) running from WinXP. I created a standalone Jython jar (per Jython website's instrs), and placed it in JMeter's lib dir. I started with an empty test plan, and created a ThreadGroup and a BSF Sampler. From the drop-down menu, I chose the script language to be "jython". In the big text box at the bottom of the sampler, I wrote the jython command:
>  >
>  >  print 5
>  >
>  >  I then added a "View Results Tree" listener.  I ran this test plan, and got an error in the <Sampler result> tab of the listener:
>  >
>  >  Response code: 500
>  >  Response message: org.apache.bsf.BSFException: exception from Jython:
>  >  Traceback (innermost last):
>  >   (no code object) at line 0
>  >  SyntaxError: ('invalid syntax', ('<string>', 1, 1, 'print 5'))
>  >
>  >  I've googled this but couldn't find any useful info or fix. Is this a bug?
>  >
>  >  By comparison, if I use a BSF Preprocessor or BSF Postprocessor (again specifying jython and "print 5"), then it works... it just doesn't work as a sampler.
>
>
> I get the same problem. The sampler code uses eval(), whereas the
>  Processors use exec(), because they are not interested in the return
>  value of the script.
>
>  I'm not sure if this is a bug in BSF or Jython; it's unlikely to be a
>  bug in JMeter because the BSF sampler works fine for some other
>  languages.
>
>  I've done some work on BSF, so I'll see if I can check that out, but
>  it may be some while before there is a fix.
>

I think it's a bug in Jython - see Bugzilla 47511.

>  >  Thank you.
>  >
>  >  Cheers,
>  >  Will
>  >
>  >  __________________________________________________
>  >  Do You Yahoo!?
>  >  Tired of spam?  Yahoo! Mail has the best spam protection around
>  >  http://mail.yahoo.com
>  >
>  >  ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  >  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>  >
>  >
>

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


Re: JMeter and Jython -- BSF Sampler not working for me

Posted by sebb <se...@gmail.com>.
On 10/07/2009, Will McQueen <wi...@yahoo.com> wrote:
>
>  Hi,
>
>  I'm attempting to use JMeter 2.3.4 with Jython 2.5 (also tried Jython 2.2.1) running from WinXP. I created a standalone Jython jar (per Jython website's instrs), and placed it in JMeter's lib dir. I started with an empty test plan, and created a ThreadGroup and a BSF Sampler. From the drop-down menu, I chose the script language to be "jython". In the big text box at the bottom of the sampler, I wrote the jython command:
>
>  print 5
>
>  I then added a "View Results Tree" listener.  I ran this test plan, and got an error in the <Sampler result> tab of the listener:
>
>  Response code: 500
>  Response message: org.apache.bsf.BSFException: exception from Jython:
>  Traceback (innermost last):
>   (no code object) at line 0
>  SyntaxError: ('invalid syntax', ('<string>', 1, 1, 'print 5'))
>
>  I've googled this but couldn't find any useful info or fix. Is this a bug?
>
>  By comparison, if I use a BSF Preprocessor or BSF Postprocessor (again specifying jython and "print 5"), then it works... it just doesn't work as a sampler.

I get the same problem. The sampler code uses eval(), whereas the
Processors use exec(), because they are not interested in the return
value of the script.

I'm not sure if this is a bug in BSF or Jython; it's unlikely to be a
bug in JMeter because the BSF sampler works fine for some other
languages.

I've done some work on BSF, so I'll see if I can check that out, but
it may be some while before there is a fix.

>  Thank you.
>
>  Cheers,
>  Will
>
>  __________________________________________________
>  Do You Yahoo!?
>  Tired of spam?  Yahoo! Mail has the best spam protection around
>  http://mail.yahoo.com
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

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