Bug 56182

Summary: Can't trigger bsh script using bshclient.jar; socket is closed unexpectedly
Product: JMeter Reporter: Krisa Chaijaroen <krisachai>
Component: MainAssignee: JMeter issues mailing list <issues>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 2.11   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description Krisa Chaijaroen 2014-02-24 08:49:57 UTC
with default bshclient.jar in lib folder.

java -jar lib/bshclient.jar localhost 9002 endurance.bsh
Connecting to BSH server on localhost:9002
Reading responses from server ...
BeanShell 2.0b5 - by Pat Niemeyer (pat@pat.net)
Exception in thread "main" java.net.SocketException: Socket is closed
... disconnected from server.
        at java.net.Socket.shutdownOutput(Socket.java:1407)
        at org.apache.jmeter.util.BeanShellClient.main(BeanShellClient.java:79)

with bshclient-2.3.3.jar from SOAPUI repository, it seems to be connected just fine.

java -jar bshclient-2.3.3.jar localhost 9002 endurance.bsh
Connecting to BSH server on localhost:9002
Reading responses from server ...
BeanShell 2.0b5 - by Pat Niemeyer (pat@pat.net)
bsh % Stepping up : 300
Setting property 'ThroughputPerMin' to '900'.
ThroughputPerMin = 900

Tried on both linux and windows machine.

java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
Comment 1 Sebb 2014-02-24 11:42:55 UTC
Odd. I'm sure that used to work.

As a temporary workround for a script without parameters, try

telnet localhost 9003
[The telnet server is http server + 1, and is actually what bshclient uses]

This should produce the "bsh %" prompt.

Then enter the following:

source("../endurance.bsh");

If you make a mistake, press ";" to end the line.

Probably best to use a separate window to compose the commands and copy/paste.

Or you could try the http interface: http://localhost:9002/
Comment 2 Sebb 2014-02-24 14:05:10 UTC
Looks like this broke sometime after 2.7. 
So another work-round is to use the version of bshclient.jar from that release.

URL: http://svn.apache.org/r1571290
Log:
Can't trigger bsh script using bshclient.jar; socket is closed unexpectedly
Bugzilla Id: 56182

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellClient.java
    jmeter/trunk/xdocs/changes.xml