POI 3.8 incompatible with dbunit 2.4.9

We are using POI 3.8 in in our application. Our project is using dbunit to load data sets from .xls files, and apparently dbunit is incompatible with POI 3.8. I get the following exception,

java.lang.NoSuchMethodError: org.apache.poi.hssf.usermodel.HSSFDateUtil.isCellDateFormatted(Lorg/apache/poi/hssf/usermodel/HSSFCell;)Z 

It seems dbunit requires POI 3.2. However I cannot downgrade my POI version. Is there any way to fix this problem. In a post I read about downloading dbunit sources and recompile it against poi 3.8. How can this recompiling be done?

Answers


There is some discussion about this at the dbunit-bugtracker at http://sourceforge.net/p/dbunit/bugs/332/, unfortunately no update there yet, so it seems dbunit itself does not support this yet.

I was able to recompile dbunit against a newer Apache POI version with the following steps:

  1. Check out dbunit code from http://dbunit.svn.sourceforge.net/svnroot/dbunit/tags/dbunit-2.4.9 via svn co http://dbunit.svn.sourceforge.net/svnroot/dbunit/tags/dbunit-2.4.9
  2. Adjust pom.xml to set the poi-dependency to just 3.9, the -FINAL was dropped in newer versions
  3. run mvn package
  4. If it fails during compiling because of oracle-jar missing, follow the steps at https://stackoverflow.com/a/18042525/411846
  5. If tests fail during building, you can try to skip them with mvn -DskipTests=true package

The resulting binary is located under target/dbunit-2.4.9.jar


I have checked the pom file here http://sourceforge.net/p/dbunit/code.git/ci/master/tree/dbunit/

and it still the version of apache poi is 3.2. Unfortunately this version is 5 years old and has less features than 3.9 such as, for instance, the Formatter and a different package for some classes such as Row.

As suggested by centic I have clone the git repo, now the version of dbunit is 2.4.10-SNAPSHOT, I have changed the apache poi version, compiled and installed with the option -Dmaven.test.skip=true.

By default a profile for oracle is activated and this obliged to have oracle jdbc driver which can be disabled or installed in the local repo as suggested above.

All the tests run smooth as before.


Need Your Help

Error in Eclipse - Mainclass not found

java eclipse main

I'm new in programing and I like it pretty much. I've just downloaded Eclipse and I got an error I can't help me with. Unfortunately it's in German but the meaning is something like: "Main class not

bypass FreeMarker caching?

java caching freemarker

Is it possible to bypass the Freemarker cache when certain templates are requested? I realise that I'll probably have to implement my own TemplateLoader in order to do this, but even so, I can't se...