我收到以下错误,
2019-01-24 12:11:27,579 ERROR o.a.j.u.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: ``import org.apache.jmeter.threads.JMeterVariables; import org.apache.poi.ss.userm . . . '' : Typed variable declaration : Class: Workbook not found in namespace.
2019-01-24 12:11:27,579 WARN o.a.j.e.BeanShellPostProcessor: Problem in BeanShell script: org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of: ``import org.apache.jmeter.threads.JMeterVariables; import org.apache.poi.ss.userm . . . '' : Typed variable declaration : Class: Workbook not found in namespace
我正在尝试执行以下代码
import org.apache.jmeter.threads.JMeterVariables;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.io.File;
import java.io.FileInputStream;
log.info("before");
FileInputStream excelFile = new FileInputStream(new File("File Path"));
log.info("excelFile");
Workbook wb = new XSSFWorkbook(excelFile);
excelFile.close();
log.info("before3");
Sheet s = wb.getSheetAt(0);
//Sheet s = wb.getSheet("Bulk Upload");
int lines = FileUtils.readLines(new File("File Path")).size(); // get lines count
//vars.put("lines", String.valueOf(lines)); // store the count into "lines" variable
int i;
for(i=0; i<=lines;i++)
{
log.info("during");
Row row = s.getRow(i);
Cell a1 = row.getCell(0);
String a1Value = a1.getStringCellValue();
Cell a2 = row.getCell(1);
String a2Value = a2.getStringCellValue();
Cell a3 = row.getCell(2);
String a3Value = a3.getStringCellValue();
Cell a4 = row.getCell(3);
String a4Value = a4.getStringCellValue();
}
log.info("after");
请让我知道为什么我会收到此错误以及我应该在哪里进行更正