I have an environment where apache poi 3.7 is deployed and getting following error on server
Exception occurred: java.lang.NoSuchFieldError: instance
at org.apache.poi.ss.formula.FormulaParser.Term(FormulaParser.java:1431)
.
.
.
when I try code with main it works fine
here is line where exception occurs
sumcell.setCellFormula(“(H”+frow+”*I”+frow+”)+(K”+frow+”*L”+frow+”)+M”+frow+”+N”+frow);
I try using SUM function but error
This is covered in the Apache POI FAQ. You have two different copies of Apache POI on your classpath, which doesn’t work. You need to ensure you only have one copy, which I’d suggest be POI 3.9 as it has lots of bug fixes since 3.7.
I’d strongly suggest you read through the POI FAQ Entry on NoSuchFieldError and follow the instructions there to track down and remove the duplicate older jar.