You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by "Tom Holmes Jr." <to...@tomholmes.net> on 2008/04/28 19:40:11 UTC

NoSuchMethodError

I am using Struts 1.2 on JBoss and using JDK 1.6_u5 using the 
poi-3.0.2-FINAL-20080204.jar.
This is the only POI jar, I did not include the contrib or scratchpad 
JAR because I didn't think I'd need them.

I wrote a program to open to an excel file which works fine. 
I create a FileInputStream, and I can open to the file and get the first 
line which is header information.
So, I create the POIFileSystem, and then I can get the Workbook, and the 
Worksheet correctly.
This works perfectly and I can output the content to my console.

I am doing a build which creates an war file within the ear file, and 
after checking the ear file I can definitely see my lib directory and I 
can see I am including the correct poi-3.0.2-FINAL-20080204.jar file.  
When I run my web-based app, I am doing a struts file upload and I get 
the byte data from that upload.  I have confirmed that the byte array 
from the file is EXACTLY the same as the byte data when the file is 
uploaded.
After the file is uploaded, I use that byte data to create a 
ByteArrayInputStream and I try to parse my Excel file the same way as 
when I read a file in directly.
And then I get this error:
java.lang.NoSuchMethodError: 
org.apache.poi.hssf.usermodel.HSSFCell.getRichStringCellValue()Lorg/apache/poi/hssf/usermodel/HSSFRichTextString; 


I don't get any errors in Eclipse indicating that this method does not 
exist.   So again, I was looking at the build to see how the EAR gets built.
I looked at the lib directory in the EAR file and I can see the JAR 
there.  If the JAR didn't exist, then I wouldn't have been able to 
create the POIFileSystem, the Workbook., or the Worksheet.

So, I am at a complete loss and need some help on figuring this out.    
Thanks!
                                                                                                                                
Tom





---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: NoSuchMethodError

Posted by "Tom Holmes Jr." <to...@tomholmes.net>.
Yep ... found it.   

In our ANT build process, we copy all the files from our /lib directory 
to our /WEB-INF/lib directory.
But ... it does not clean out any previously existing jars ... so they 
were there when I did my build.
I knew it had to be something with our build process because the code 
ran well from within Eclipse where the classpath did NOT have the old jar.

Thanks for the help!  
                                           Tom

Nick Burch wrote:
> On Mon, 28 Apr 2008, Tom Holmes Jr. wrote:
>> And then I get this error:
>> java.lang.NoSuchMethodError: 
>> org.apache.poi.hssf.usermodel.HSSFCell.getRichStringCellValue()Lorg/apache/poi/hssf/usermodel/HSSFRichTextString; 
>>
>
> You have an older version of POI somewhere on your classpath
>
> Try outputting in your webapp something like:
>    HSSFCell.class.getClassLoader().
>       
> getResource("org/apache/poi/hssf/usermodel/HSSFCell.class").getPath()
>
> You should get back a path to your .jar file, which my guess is 
> actually poi 2.5.1 hiding somewhere
>
> Nick
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: NoSuchMethodError

Posted by "Tom Holmes Jr." <to...@tomholmes.net>.
I was Googling more on this issue ... I always try Google before I post 
to a mailing list, and that is the same answer I got.

That there is an older poi 2.5.1 jar hiding somewhere.    That's what I 
am looking for now.
That was the older jar we were using, and I was hoping our build process 
removed it, but I did search and I saw the jar in some JBoss tmp 
directories.
If this is a problem on my local system, then I have to worry about it 
on our QA and Prod systems ... to make sure we remove the reference to 
the old jars.

I'll keep looking for that old jar and remove it, and I will let the 
list know how I made out.
It could help someone else out in the future.    Thanks!
                                                                                                       
Tom

Nick Burch wrote:
> On Mon, 28 Apr 2008, Tom Holmes Jr. wrote:
>> And then I get this error:
>> java.lang.NoSuchMethodError: 
>> org.apache.poi.hssf.usermodel.HSSFCell.getRichStringCellValue()Lorg/apache/poi/hssf/usermodel/HSSFRichTextString; 
>>
>
> You have an older version of POI somewhere on your classpath
>
> Try outputting in your webapp something like:
>    HSSFCell.class.getClassLoader().
>       
> getResource("org/apache/poi/hssf/usermodel/HSSFCell.class").getPath()
>
> You should get back a path to your .jar file, which my guess is 
> actually poi 2.5.1 hiding somewhere
>
> Nick
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: NoSuchMethodError

Posted by Nick Burch <ni...@torchbox.com>.
On Mon, 28 Apr 2008, Tom Holmes Jr. wrote:
> And then I get this error:
> java.lang.NoSuchMethodError: 
> org.apache.poi.hssf.usermodel.HSSFCell.getRichStringCellValue()Lorg/apache/poi/hssf/usermodel/HSSFRichTextString;

You have an older version of POI somewhere on your classpath

Try outputting in your webapp something like:
    HSSFCell.class.getClassLoader().
       getResource("org/apache/poi/hssf/usermodel/HSSFCell.class").getPath()

You should get back a path to your .jar file, which my guess is actually 
poi 2.5.1 hiding somewhere

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org