问题
I would like to use newer version of Apache POI with ColdFusion 10 than the one with which it ships, as I need to access some of the newer functionality.
I have tried swapping ColdFusion's Apache POI JAR files for the newer versions but this causes some of the built in ColdFusion spreadsheet functionality to break.
Is it possible to load in the newer version for use in my code but leave ColdFusion's version untouched so that the built in spreadsheet functionality still works?
I know it is possible to specify a custom Java load path in CF10 but if I try and load in a newer version of a library which has already been loaded for use by ColdFusion will this cause a clash?
回答1:
It is possible to use Mark Mandel's JavaLoader (https://github.com/markmandel/JavaLoader) to use a newer version of Apache POI with ColdFusion 10 without affecting CF's built in spreadsheet functionality.
I used version 3.11-beta2 of Apache POI because this does not depend on dom4j.jar which seems to be problematic.
I used JavaLoader instead of CF10's built-in ability to load JARs because this allows me to access ColdFusion's older version of Apache POI using createObject()
whilst accessing the newer version stored in my webroot using the JavaLoader method server[application.JavaLoader].create()
.
来源:https://stackoverflow.com/questions/25524979/using-a-newer-version-of-apache-poi-in-coldfusion-10