Bug 56182 - Can't trigger bsh script using bshclient.jar; socket is closed unexpectedly
Summary: Can't trigger bsh script using bshclient.jar; socket is closed unexpectedly
Status: RESOLVED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.11
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-24 08:49 UTC by Krisa Chaijaroen
Modified: 2014-02-24 14:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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
Comment 3 The ASF infrastructure team 2022-09-24 20:37:56 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/3328