从Excel中检索数据时出现NoSuchMethodException

时间:2019-05-08 18:52:45

标签: java selenium-webdriver

从excel检索数据时,出现NoSuchMehtodException错误

public void readXLSX() throws IOException {
        //Step1: File path
        String filePath="C:\\Users\\Bharath\\eclipse-workspace\\Testing\\src\\test\\java\\Utilities\\Read.xlsx";
        File f= new File(filePath);

        //Step2: Create WorkBook
        FileInputStream inputStream = new FileInputStream(f);
         XSSFWorkbook book = new XSSFWorkbook(inputStream);
        //Step3: Create Sheet
        XSSFSheet sheet= book.getSheet("Sheet1");
        //Step4: Read Row
        XSSFRow row= sheet.getRow(0);
        //Step5: Read each Cell
        XSSFCell cell= row.getCell(1);
        System.out.println(cell.toString());

        //Reading all the values

        //Step1: Get Row
        int rows= sheet.getLastRowNum();

        //Step2: Traverse through each row
        for(int i=0;i<=rows;i++) {

            Row thisRow= sheet.getRow(i);
            int cols= thisRow.getLastCellNum();

            for(int j=0;j<cols;j++) {
                System.out.print(thisRow.getCell(j).toString());
                System.out.print("|");
            }
            System.out.println();
        }

        inputStream.close();

    }
}

java.lang.NoSuchMethodError:org.apache.poi.util.POILogger.log(ILjava / lang / Object;)V

0 个答案:

没有答案