我在嘗試使用eclipse中的硒JUni4 Web驅動程序打開Excel文件時遇到以下錯誤。錯誤和代碼如下所示。我是JAVA新手。請幫忙。使用硒web驅動程序獲取NoClassDefFoundError
public void xlRead_TC(String sPath, int sSheet) throws Exception{
//Workbook book = Workbook.createWorkbook(f);
System.out.println("Step 1B - Opening excel files Reached");
File myxl = new File(sPath);
FileInputStream myStream = new FileInputStream(myxl);
//Workbook w;
//w = Workbook.getWorkbook(myStream);
XSSFWorkbook myWB = new XSSFWorkbook(myStream);
//XSSFSheet mySheet = myWB.getSheetAt(sSheet); // Referring to 1st sheet
//xRows_Inp = mySheet.getLastRowNum()+1;
//xCols_Inp = mySheet.getRow(0).getLastCellNum();
System.out.println("Rows are " + xRows_Inp);
System.out.println("Cols are " + xCols_Inp);
//Workbook[] wbs = new Workbook[] { new HSSFWorkbook(), new XSSFWorkbook() };
//xRows_TC = mySheet.getLastRowNum()+1;
//xCols_TC = mySheet.getRow(0).getLastCellNum();
//System.out.println("Rows are " + xRows_TC);
//System.out.println("Cols are " + xCols_TC);
//xData_TC = new String[xRows_TC][xCols_TC];
}
異常
java.lang.NoClassDefFoundError: org/dom4j/DocumentException
at org.apache.poi.openxml4j.opc.OPCPackage.init(OPCPackage.java:154)
at org.apache.poi.openxml4j.opc.OPCPackage.<init>(OPCPackage.java:141)
at org.apache.poi.openxml4j.opc.Package.<init>(Package.java:54)