Discussion:
Odd behavior with SXSSF sheets
Joltes, Richard
2018-03-30 19:44:02 UTC
Permalink
Hello all,

New subscriber, and I can't see anything in the archives so I hope this
hasn't been discussed before. I have an application that uses the SXSSF
style sheets, and which was working just fine until I reopened the project
today. Now it's showing lots of type-mismatch errors, and I've no idea why.
Rough outline:

1) instantiate an SXSSF workbook (protected SXSSFWorkbook wb;)
2) create a matching sheet (protected SXSSFSheet sheet1;)

But then, when I try to instantiate the sheet the fun starts

sheet1 = wb.createSheet("sheet1");

Here, Eclipse is telling me to add a cast to SXSSFSheet, which makes no
sense since that's how the sheet was created in the first place.

From then on it's all the same --

SXSSFRow r = sheet1.createRow(0); same type/cast error

Creating an SXSSF cell obviously does the same thing.

Even odder, all the previously working ColorScaleFormatting and other color
oriented code is showing up as undefined. Again, all this code was working
last time I had the project open. I've no explanation for this behavior.

I was using 3.16, but just migrated to 3.17 and got the same behavior.

Any ideas?

Thx,

Dick Joltes
Harvard University
Dominik Stadler
2018-03-31 05:58:13 UTC
Permalink
Hi,

Sounds like a messed up classpath in Eclipse or some other problem with the
IDE, I would start in the project settings where the libraries are
configured to check if poi-ooxml-* is still listed correctly there as well.

Dominik.
Post by Joltes, Richard
Hello all,
New subscriber, and I can't see anything in the archives so I hope this
hasn't been discussed before. I have an application that uses the SXSSF
style sheets, and which was working just fine until I reopened the project
today. Now it's showing lots of type-mismatch errors, and I've no idea why.
1) instantiate an SXSSF workbook (protected SXSSFWorkbook wb;)
2) create a matching sheet (protected SXSSFSheet sheet1;)
But then, when I try to instantiate the sheet the fun starts
sheet1 = wb.createSheet("sheet1");
Here, Eclipse is telling me to add a cast to SXSSFSheet, which makes no
sense since that's how the sheet was created in the first place.
From then on it's all the same --
SXSSFRow r = sheet1.createRow(0); same type/cast error
Creating an SXSSF cell obviously does the same thing.
Even odder, all the previously working ColorScaleFormatting and other color
oriented code is showing up as undefined. Again, all this code was working
last time I had the project open. I've no explanation for this behavior.
I was using 3.16, but just migrated to 3.17 and got the same behavior.
Any ideas?
Thx,
Dick Joltes
Harvard University
Javen O'Neal
2018-03-31 09:30:00 UTC
Permalink
And double check that all your POI jars in the class path are from the same
version.

You could try cleaning and running your project from
ant/maven/gradle/whatever your project is built with to determine if your
IDE is referencing other jars or missing jars that are causing the cast
errors.
Post by Dominik Stadler
Hi,
Sounds like a messed up classpath in Eclipse or some other problem with the
IDE, I would start in the project settings where the libraries are
configured to check if poi-ooxml-* is still listed correctly there as well.
Dominik.
Post by Joltes, Richard
Hello all,
New subscriber, and I can't see anything in the archives so I hope this
hasn't been discussed before. I have an application that uses the SXSSF
style sheets, and which was working just fine until I reopened the
project
Post by Joltes, Richard
today. Now it's showing lots of type-mismatch errors, and I've no idea
why.
Post by Joltes, Richard
1) instantiate an SXSSF workbook (protected SXSSFWorkbook wb;)
2) create a matching sheet (protected SXSSFSheet sheet1;)
But then, when I try to instantiate the sheet the fun starts
sheet1 = wb.createSheet("sheet1");
Here, Eclipse is telling me to add a cast to SXSSFSheet, which makes no
sense since that's how the sheet was created in the first place.
From then on it's all the same --
SXSSFRow r = sheet1.createRow(0); same type/cast error
Creating an SXSSF cell obviously does the same thing.
Even odder, all the previously working ColorScaleFormatting and other
color
Post by Joltes, Richard
oriented code is showing up as undefined. Again, all this code was
working
Post by Joltes, Richard
last time I had the project open. I've no explanation for this behavior.
I was using 3.16, but just migrated to 3.17 and got the same behavior.
Any ideas?
Thx,
Dick Joltes
Harvard University
Joltes, Richard
2018-04-03 18:22:15 UTC
Permalink
Yep, I finally started pulling external jars from the classpath and found
one that had been recently upgraded. Once I re-added the new version back
in, the problem vanished and the errors are gone. Whew!

cheers,

dj
Post by Javen O'Neal
And double check that all your POI jars in the class path are from the same
version.
You could try cleaning and running your project from
ant/maven/gradle/whatever your project is built with to determine if your
IDE is referencing other jars or missing jars that are causing the cast
errors.
Post by Dominik Stadler
Hi,
Sounds like a messed up classpath in Eclipse or some other problem with
the
Post by Dominik Stadler
IDE, I would start in the project settings where the libraries are
configured to check if poi-ooxml-* is still listed correctly there as
well.
Post by Dominik Stadler
Dominik.
Post by Joltes, Richard
Hello all,
New subscriber, and I can't see anything in the archives so I hope this
hasn't been discussed before. I have an application that uses the SXSSF
style sheets, and which was working just fine until I reopened the
project
Post by Joltes, Richard
today. Now it's showing lots of type-mismatch errors, and I've no idea
why.
Post by Joltes, Richard
1) instantiate an SXSSF workbook (protected SXSSFWorkbook wb;)
2) create a matching sheet (protected SXSSFSheet sheet1;)
But then, when I try to instantiate the sheet the fun starts
sheet1 = wb.createSheet("sheet1");
Here, Eclipse is telling me to add a cast to SXSSFSheet, which makes no
sense since that's how the sheet was created in the first place.
From then on it's all the same --
SXSSFRow r = sheet1.createRow(0); same type/cast error
Creating an SXSSF cell obviously does the same thing.
Even odder, all the previously working ColorScaleFormatting and other
color
Post by Joltes, Richard
oriented code is showing up as undefined. Again, all this code was
working
Post by Joltes, Richard
last time I had the project open. I've no explanation for this
behavior.
Post by Dominik Stadler
Post by Joltes, Richard
I was using 3.16, but just migrated to 3.17 and got the same behavior.
Any ideas?
Thx,
Dick Joltes
Harvard University
Loading...