這是我的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的聲明? –