We are unable to instantiate the HSSFWorkbook-object. HelloExcel class is executed with all poi-jars in our classpath as wel as the log4j.jar statement in error: HSSFWorkbook werkboek = new HSSFWorkbook(); This is the error: Message ID: RNQ0301 Message: Java exception received when calling Java method (C G D F). cause: RPG procedure TRQTSRC in program TRQTSRC/LXCONT received Java exception "java.lang.NoSuchMethodError:" when calling method "<init>" with signature "()V" in class "net.sourceforge.poi.hssf.usermodel.HSSFWorkbook". ... this is the code of HelloExcel: import java.io.*; import net.sourceforge.poi.hssf.usermodel.*; public class HelloExcel { public static void main(String[] args) throws IOException { FileOutputStream bestand = new FileOutputStream(args[0]); HSSFWorkbook werkboek = new HSSFWorkbook(); HSSFSheet werkblad = werkboek.createSheet(); werkboek.setSheetName(0, "eerste werkblad"); for (short rownum = (short) 0; rownum < 10; rownum++) { HSSFRow rij = werkblad.createRow(rownum); HSSFCell cel = rij.createCell( (short) 0, HSSFCell.CELL_TYPE_NUMERIC); cel.setCellValue(rownum + 1); cel = rij.createCell( (short) 1, HSSFCell.CELL_TYPE_NUMERIC); cel.setCellValue((rownum + 1) * (rownum + 1)); } werkboek.write(bestand); bestand.close(); } }
Please don't take this harshly but... You really need to upgrade. That version is what... nearly a year old? It may be a bug (I think this is actually something wrong with your environment and most likely a mismatch in the version of log4j), but if so then it must have been fixed in one of the last two production releases as lots of people are using it and successfully instantiating HSSFWorkbook :-). Secondly, this type of question really belongs on the poi-user list http://jakarta.apache.org/poi/getinvolved/index.html. One can suspect strongly that not being able to run elementary code like this would be a usage issue rather than a bug. I'm marking this as INVALID and suggesting strongly that: 1. You upgrade to 1.5.1 2. Ask your question on the list at least two good reasons for this: 1. There is no way in heck I'm ever going to fix a bug in a production release that has been superceded by a later version (because even if I did it would go into the next version) 2. Not all of the user community reads the bug reports, and I'm like 99% sure you're running this on a machine I know nothing about, but I'll bet some of the other POI users do, and they could help you way better than the developers who are mostly on Window/Unix.