poi versions and classpath

1
We have been using version 3.6 of the poi library with certain Java actions which require facilities not available in 3.1. Sometimes when we deploy this the Java compiler can't find the 3.6 version and tries to compile with 3.1, which Mendix apparently adds to the mix at deployment time. I seem to remember someone fixing this but can't remember how. How would we manipulate the classpath to make sure that the 3.6 version is picked up by the compiler? We aren't using any inbuilt Excel features so we don't need 3.1 at all. Are there plans to update the poi version that ships with Mendix?
asked
2 answers
1

We've solved this by using our java library in the userlib folder. You can override the default mendix library by adding some java parameters to your project settings I think.

Edit:

You could also use your own class loader to just use your own libraries in some custom function.

answered
1

Hi Martin, we solved this problem a while back by removing the POI libraries from the WEB-INF/lib directory entirely, replacing them with POI version 3.6 (also the contrib libs etc.). However, this is not without risk! It is possible that the Mendix runtime or server uses POI 3.1 specific code that is no longer available in 3.6. We didn't encounter any problems though, but that was Mendix version 2.4.5.

The alternative is changing the order of the classpath. If you manage to put your POI 3.6 jar in the classpath in front of the out-of-the-box 3.1 version, the Java runtime will find and load your 3.6 classes first. Also this isn't without risk, because this could potentially lead to mixing POI 3.1 classes with 3.6, causing unexpected results (and probably errors).

Kind regards, Jonathan

answered