简体   繁体   中英

why I am getting java.lang.AbstractMethodError: org.apache.poi.xssf.usermodel.XSSFCellStyle.getFillBackgroundColorColor()?

I am getting this error in Java in the below line:

Color cellColor = (row.getCell(1).getCellStyle().getFillBackgroundColorColor());`

java.lang.AbstractMethodError: org.apache.poi.xssf.usermodel.XSSFCellStyle.getFillBackgroundColorColor()Lorg/apache/poi/ss/usermodel/Color;

I have also checked the WEB-INF/lib folder and there are only two Jars ojdbc5.jar and ojdbc6.jar

I don't know why I am getting this error while using getFillBackgroundColorColor() .

Basically, I want to get the color of a cell. Can someone help me to resolve the issue?

An AbstractMethodError usually means that there is a mixup in dependencies. Perhaps you are missing poi-ooxml or have multiple versions of it?

Having WEB-INF/lib implies that you are deploying a WAR file. In this case libraries can be in few different places eg $TOMCAT_HOME/lib . Check your classpath eg by printing all the URLs that are part of it:

ClassLoader cl = ClassLoader.getSystemClassLoader();
URL[] urls = ((URLClassLoader) cl).getURLs();
for (URL url : urls) {
    System.out.println(url.getFile());
}

and make sure that POI is in the right version. If you are using Tomcat you can check out this article .

As a side note your probably shouldn't ship ojdbc5.jar , it's a very old driver for a very old JDK and Oracle DB.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM