While trying to export data from db to an Excel file using HSSF, I get the following error: java.lang.NoSuchMethodError: org.apache.poi.hssf.usermodel.HSSFRow.createCell(I)Lorg/apache/poi/hssf/usermodel/HSSFCell Method that is being used: HSSFRow.createCell(int) I have changed from using the deprecated method HSSFRow.createCell(short), because of an issue with rows greater than 32768 (methods bombs out, reason relating to Bug 44539). private HSSFWorkbook createWorkbook() throws IOException { HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = wb.createSheet("WorkSheet1"); HSSFRow row = sheet.createRow(); for(int i=0; i < 10; i++){ row.createCell(i).setCellValue(new HSSFRichTextString("somesort of string")); } return wb; } I've tried with precompiled libraries versions 3.2 Final and 3.5 Beta with no luck.
Check the classpath and try 3.5-Beta4. HSSFRow.createCell(int) is there. Yegor
That's the strange thing. In both 3.2, and 3.5 beta4, it is in the classpath, however during runtime, it won't pick it up. public final class HSSFRow implements java.lang.Comparable, org.apache.poi.ss.usermodel.Row { ... public org.apache.poi.hssf.usermodel.HSSFCell createCell(int p1) { } public org.apache.poi.hssf.usermodel.HSSFCell createCell(int p1, int p2) { } ... } I'm using Oracle Containers 4 Java (OC4J) as my server. Not sure whether this is causing the issue or not. I've also tried compiling the src myself and using that (thinking there could have been an issue with the binary), however, same issue still occurs.
You can check the path to the POI jar as follows: System.out.println(HSSFWorkbook.class.getProtectionDomain().getCodeSource().getLocation());