Skip to content

Loading the POI java libraries

Julian Halliwell edited this page Nov 19, 2023 · 14 revisions

This library is essentially a wrapper for the spreadsheet functionality available in the Apache POI Java API and needs the POI and other supporting java libraries ("jars") to be "loaded" so that they can be invoked.

However if your CFML engine already uses older versions of any of these libraries, conflicts may arise.

Lucee

To ensure this doesn't happen Lucee (from version 2.14.0 of the library) loads the jars using OSGi from a specially provided "bundle" (lib-osgi.jar) which is included in the root.

The OSGi bundle is automatically installed to Lucee the first time it runs and will appear in your server administrator's "Info -Bundle (jar)" list as:

Spreadsheet CFML (spreadsheet-cfml)

The bundle can be uninstalled by calling the following method on the library:

spreadsheet = New spreadsheetLibrary.Spreadsheet();
spreadsheet.flushOsgiBundle();

Use of lib-osgi.jar in Lucee means that you do not need the lib or javaLoader folders that come with the library.

Adobe ColdFusion

If you are using Adobe ColdFusion the jars are loaded using JavaLoader to ensure the correct versions are used.

Avoiding JavaLoader by customising the contents of your Java Class Path

If you are using ColdFusion and would prefer not to use JavaLoader (perhaps for security reasons) you have the option of doing this as long as you are happy to customise your engine's installation to avoid version clashes. You will need to:

  1. Remove the existing POI and other jars from your engine's core java class path.
  2. Ensure the jars in the /lib folder of the Spreadsheet Library are added to your engine's java class path.
  3. Pass the following parameter to the Spreadsheet Library's init() method:
spreadsheet = New spreadsheetLibrary.spreadsheet( requiresJavaLoader=false );

Using an existing copy of JavaLoader

If JavaLoader is required for your environment and you already have a copy available on your server, you can configure the library to use that instead of the bundled version. Simply specify the dot path of the JavaLoader.cfc component as the javaLoaderDotPath init argument. For example:

spreadsheet = New spreadsheetLibrary.spreadsheet( javaLoaderDotPath="myLibrary.javaloader.JavaLoader" );
Clone this wiki locally