这是我的BeanShell代码来创建一个文件和一行追加到它创建文件时:的JMeter错误尝试使用BeanShell的
FileName = vars.get("fileName");
f = new FileOutputStream(FileName,true);
p = new PrintStream(f);
this.interpreter.setOut(p);
print("Test Set: " + FileName);
f.close();
我在以前的采样正则表达式提取得到的文件名。我检查了调试后处理器,并确认这是设置正确的。不过,我在采样结果得到这个错误:
Response code: 500
Response message: org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of: ``FileName = vars.get("fileName"); f = new FileOutputStream(FileNam . . . '' : Object constructor
:
如果你不希望有一些默认的名称,也可以在此时退出脚本你不忘记使用像“字符串FileName = vars.get ...” –
我曾尝试声明它为一个字符串,如你所说,但这并没有解决问题 – user3871995
你有正确的f和p的声明? –