Java - org.apache.poi.ss.usermodel.Font.setBold(Z)V while trying to make a Excel Sheet, gives NoSuchMethodError

*爱你&永不变心* 提交于 2019-12-11 17:18:29

问题


So, I have this application where data is sent to me and I have to make it into an Excel sheet. I use Eclipse IDE, I do not have any errors in the code I have written. But it gives an exception at setBold(bold) method.
Here is the stacktrace

Sep 27, 2017 5:03:03 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/<appName>] threw exception [Handler processing failed; nested exception is java.lang.NoSuchMethodError: org.apache.poi.ss.usermodel.Font.setBold(Z)V] with root cause
java.lang.NoSuchMethodError: org.apache.poi.ss.usermodel.Font.setBold(Z)V
at <fullpath>.Excel.setCurrentFont(Excel.java:177)

Now, I know that setBold(boolean bold) accepts only Boolean values. I have not made any error wherever in my code. The stacktrace points a Line in Excel.java which is given below...

public void setCurrentFont(String fontName, short fontSize, boolean bold,
        boolean italic, short colorIndex, short offset, byte underline) {
    Font font = wb.createFont();
    font.setFontName(fontName);
    font.setBold(bold);
    font.setFontHeightInPoints(fontSize);
    font.setColor(colorIndex);
    font.setItalic(italic);
    font.setTypeOffset(offset);
    font.setUnderline(underline);
    currentFont = font;
}

By the stacktrace, org.apache.poi.ss.usermodel.Font.setBold(Z)V, I think it is searching for a method setBold(Z)V; where Z, V are values (my assumption) but setBold(boolean bold); is the method in that poi?

I have been using

org.apache.poi V 3.12 Eclipse IDE

来源:https://stackoverflow.com/questions/46447105/java-org-apache-poi-ss-usermodel-font-setboldzv-while-trying-to-make-a-excel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!