如何在JMeter-System.FormatException上处理此问题:Base-64字符数组或字符串的长度无效

如何在JMeter-System.FormatException上处理此问题:Base-64字符数组或字符串的长度无效,jmeter,Jmeter,我已经配置了令牌,但我正在尝试使用csv文件作为登录凭据。登录凭据生成代码尝试使用BeanShell处理器脚本创建一个基本的64个enoded字符数组,并将其作为登录凭据传递 import org.apache.commons.codec.binary.Base64; log.info(“Base64 Encoding ClientID & ClientPassword”); //Create the complete string which needs to be encoded S

我已经配置了令牌,但我正在尝试使用csv文件作为登录凭据。登录凭据生成代码

尝试使用BeanShell处理器脚本创建一个基本的64个enoded字符数组,并将其作为登录凭据传递

import org.apache.commons.codec.binary.Base64;
log.info(“Base64 Encoding ClientID & ClientPassword”);
//Create the complete string which needs to be encoded
String forEncoding = vars.get(“ClientID”) + “:” + vars.get(“ClientPassword”);
log.info(“forEncoding: “ + forEncoding);
//Encode the string
byte[] encoded_ClientCredentials = Base64.encodeBase64(forEncoding.getBytes());
//Save the encoded byte array into a String Variable
vars.put(“encoded_ClientCredentials”, new String(encoded_ClientCredentials));
log.info(“encoded_ClientCredentials: “ + vars.get(“encoded_ClientCredentials”));
如果您需要提供编码的凭证,您可以使用该凭证,该凭证可以通过bundle获得,bundle可以使用

有关更多详细信息,请参阅文章


从您的问题来看,还不清楚应该如何传递凭据,如果是关于它的话,那么使用起来可能会容易得多