本文介绍了JMeter(主动?)FTP到VLTrader的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

情况:
我正在使用JMeter来加载测试我的通信应用程序(Cleo VLTrader)。我是JMeter的新手,能够使HTTP通信正常工作,但不能使用FTP。当我尝试使用JMeter FTP请求采样器时,我可以在服务器端看到JMeter正在发出一个PASV命令,此后不久由于502 PASV命令不可用错误而失败。



问题:
如何配置我的JMeter FTP请求采样器以连接到我的FTP服务器?

解决方案 1. 对不起,但只是为了确保:您是否确保FTP连接手动成功,即不是来自jmeter脚本中的FTP请求,而是通过控制台/ telnet连接任何FTP客户端工具?





2。 FTP被动模式

可能的原因:

由于您的FTP请求在PASV命令执行期间失败,可以假设根本原因是您的ftp服务器不支持被动模式而jmeter的FTP请求默认情况下使用被动模式。



确保尝试在连接后切换到被动模式从你的ftp到控制台,
eg

  telnet your.ftp.server.url 21 
USER yourusername
PASS yourpassword
PASV

  ftp -d your.ftp.server.url 
USER yourusername
PASS yourpassword
passive

或者使用任何可以选择模式(主动/被动)连接的ftp客户端工具。

如果在此期间出现同样的问题 - 问题是您的ftp服务器不支持被FTP请求使用的被动模式。



此解释这两种模式。





可能的解决方案: $ b b根据。



但是您可以自己实现ftp请求,避免使用FTP请求。

您可以使用从中的脚本ftp连接。



非常简化,它可能如下所示:
$ b

import org。 apache.commons.net.ftp *。

FTPClient client = new FTPClient();
client.setDataTimeout(3600000);
client.connect(ftpHost,ftpPort);
client.login(userName,userName);
client.setFileType(FTPClient.BINARY_FILE_TYPE);



// FTPClient默认使用'主动模式'
if(ftp_passive_mode){
client.enterLocalPassiveMode();
} else {
client.enterLocalActiveMode();
}

...

client.logout();
client.disconnect();

也许我错了,您问题的原因隐藏在另一个地方。

希望这会帮助您诊断并解决您的问题。


Situation:I'm using JMeter to load test my communications application (Cleo VLTrader). I'm new to JMeter, and have been able to get HTTP communication working, but not FTP. When I attempt to use a JMeter FTP Request sampler, I can see on the server side that the JMeter is issuing a "PASV" command, and failing shortly thereafter due to a "502 PASV command not available" error.

Question:How do I need to configure my JMeter FTP Request sampler to connect to my FTP server?

解决方案

1. Sorry for this but just to ensure: have you ensured that FTP connection succeeds manually, i.e. not from FTP Request in jmeter script but via console/telnet connection or any FTP client utility?


2. FTP Passive mode

Possible cause:
Since your FTP Request fails during PASV command execution can suppose that the root cause is that your ftp server doesn't support passive mode while jmeter's FTP Request uses passive mode by default.

To ensure this try to switch into Passive mode after connecting to your ftp from console,e.g.

telnet your.ftp.server.url 21
USER yourusername
PASS yourpassword
PASV

or

ftp -d your.ftp.server.url
USER yourusername
PASS yourpassword
passive

or using any ftp client utility which have option to select mode (active/passive) for connection.

If the same issue appears during this - well, the problem is that your ftp server doesn't support passive mode which is used by FTP Request.

See e.g. this for explanation of differences in both the modes.


Possible solution:
As per jmeter sources:

ftp.enterLocalPassiveMode();

switch to passive mode is used by default and there is no possibility to set mode externally in FTP Request configuration screen.

But you can implement ftp request yourself, avoiding usage of FTP Request.
You can use FTPClient realization from Apache Commons Net and script ftp connection in BeanShell Sampler.

Very simplified this may look like:

import org.apache.commons.net.ftp.*;

FTPClient client = new FTPClient();
client.setDataTimeout(3600000);
client.connect(ftpHost,ftpPort);
client.login(userName, userName);
client.setFileType(FTPClient.BINARY_FILE_TYPE);

...

// FTPClient uses 'active mode' by default
if (ftp_passive_mode) {
    client.enterLocalPassiveMode();
} else {
    client.enterLocalActiveMode();
}

...

client.logout();
client.disconnect();

Maybe also I'm wrong and the reason of your issue hides in another place.
Hope this will help you to diagnose and solve your problem.

这篇关于JMeter(主动?)FTP到VLTrader的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 06:01