问题
I am getting a java.lang.IncompatibleClassChangeError with the following snippet:
Workbook workbook = new HSSFWorkbook();
Font arial = workbook.createFont(); // java.lang.IncompatibleClassChangeError thrown here
I am using POI 3.7 with WebSphere 7 Portal Server. The same code (and as far as I can tell, the same jars) worked with Netbeans console application. It also seems that the 3.7 jar is the only one in the classpath. The project also uses JasperReports 4.1.2. Can I provide more information?
回答1:
I'm almost certain that you have an older version of POI on your classpath
There's a section in the POI FAQ that covers this very case. You'll want to use the code from there to identify where the extra copy of POI is coming from, and zap the old jar
来源:https://stackoverflow.com/questions/7995824/poi-3-7-java-lang-incompatibleclasschangeerror-when-instantiating-a-font