search cancel

Groovy script in JMeter test works locally but fails when executed from BlazeMeter

book

Article ID: 214580

calendar_today

Updated On:

Products

BlazeMeter

Issue/Introduction

A JMeter script with a JSR223 Sampler plugin with a method to allow for controlling of unknown hosts with “StrictHostKeyChecking” parameter when connecting to a configured SFTP server works locally.

The same JMeter script fails when it is uploaded to a BlazeMeter test and executed from BlazeMeter.

The test fails with the following error:

Code  500

Description

javax.script.ScriptException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script178.groovy: 5: unable to resolve class JSch @ line 5, column 12.def jsch = new JSch()
Script178.groovy: 12: unable to resolve class Session @ line 12, column 14. Session session = jsch.getSession(user, host, port);
Script178.groovy: 24: unable to resolve class Channel @ line 24, column 10. Channel channel = session.openChannel( "sftp" )
Script178.groovy: 27: unable to resolve class ChannelSftp @ line 27, column 14. ChannelSftp sftpChannel = (ChannelSftp) channel
Script178.groovy: 27: unable to resolve class ChannelSftp @ line 27, column 28. ChannelSftp sftpChannel = (ChannelSftp) channel
5 errors

The top of the JSR223 Sampler script contains the “import com.jcraft.jsch.*;” line.

Cause

Not all jar files required by the Groovy script were uploaded to the JMeter test in BlazeMeter (ex the jsch jar file).

Environment

Release : SAAS

Component : BLAZEMETER PERFORMANCE TESTING

Resolution

As specified in the Test Works Locally but not on BlazeMeter article, all files used by the test when executed locally, must be uploaded to the test in BlazeMeter.  That includes jar files required to by the test that are not part of the standard JMeter install.