Bug 46667 - HSSF.createCell(int) - java.lang.NoSuchMethodError
Summary: HSSF.createCell(int) - java.lang.NoSuchMethodError
Status: RESOLVED INVALID
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.2-FINAL
Hardware: PC Windows XP
: P1 blocker (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-05 23:19 UTC by Chris Noonan
Modified: 2009-02-08 23:16 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Noonan 2009-02-05 23:19:47 UTC
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.
Comment 1 Yegor Kozlov 2009-02-06 02:24:35 UTC
Check the classpath and try 3.5-Beta4.  HSSFRow.createCell(int) is there.

Yegor
Comment 2 Chris Noonan 2009-02-08 16:50:30 UTC
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.
Comment 3 Yegor Kozlov 2009-02-08 23:16:37 UTC
You can check the path to the POI jar as follows:
        System.out.println(HSSFWorkbook.class.getProtectionDomain().getCodeSource().getLocation());