Here then is the this.javaSettings test I talked about in my last post:
1. Confirm default POI version
My environment is ColdFusion 2025 Update 3. Like ColdFusion 2023 Update 15 it has POI 5.4.1.
To confirm this, launch a CFM page containing the code
<cfoutput>#createObject("java", "org.apache.poi.Version").getVersion()#</cfoutput>
The output is: 5.4.1
2. Create the test component, excel.cfc
Its location under wwwroot is /shared/cf/excel.cfc (to emulate the path @skallaje had used).
Its code is
<cfcomponent>
<cffunction name="getPOIversion" returntype="string" output="false">
<cfset var version = createObject( "java", "org.apache.poi.Version").getVersion()>
<cfreturn "The POI version is " & version>
</cffunction>
</cfcomponent>
3. Download POI 3.17 libraries and deploy them for testing
Go to the POI library archive and download the file poi-bin-3.17-20170915.zip.
Unpack it and you'll get the folder poi-3.17.
Create the new directory my_POI_library directly under wwwroot. Copy or move the folder poi-3.17 into my_POI_library.
4. Create the Application.cfc containing the appropriate this.javaSettings configuration
The file Application.cfc is to be located in /shared/cf/.
Its code is:
<!---
This is the Application.cfc file for a ColdFusion application.
It defines application-wide settings and event handlers.
--->
<cfcomponent>
<!--- Application-wide settings, defined in the THIS scope. --->
<cfset this.name = "MyCFApplication">
<cfset this.sessionManagement = true>
<cfset this.sessionTimeout = createTimeSpan(0, 0, 30, 0)>
<cfset this.applicationTimeout = createTimeSpan(1, 0, 0, 0)>
<cfset this.javaSettings = {loadPaths = ["\my_POI_library\poi-3.17\"], loadColdFusionClassPath = true, reloadOnChange= true}>
<cffunction name="onApplicationStart" returntype="boolean">
<cfreturn true>
</cffunction>
<cffunction name="onSessionStart">
</cffunction>
<cffunction name="onRequestStart">
<cfargument name="thePage" required="true">
<cfreturn true>
</cffunction>
<cffunction name="oncfcRequest" returnType="string">
<cfargument type="string" name="cfcName">
<cfargument type="string" name="method">
<cfargument type="struct" name="args">
<cfinvoke
returnvariable="local.version"
component="#arguments.cfcName#"
method="#arguments.method#">
<cfreturn local.version>
</cffunction>
<cffunction name="onRequestEnd">
<cfargument name="thePage" required="true">
</cffunction>
<cffunction name="onApplicationEnd">
<cfargument name="applicationScope" required="true">
</cffunction>
<cffunction name="onSessionEnd">
<cfargument name="sessionScope" required="true">
<cfargument name="applicationScope" required="true">
</cffunction>
</cfcomponent>
5. Restart ColdFusion.
6. Make an HTTP request to the getPOIversion method of excel.cfc
In my test, I simply make the request by launching http://127.0.0.1:8500/shared/cf/excel.cfc?method=getPOIversion in a browser.
The output: The POI version is 3.17
I think I have my issue resolved. The following is what I just did.
-- I created a folder called "_jars" in "shared" folder and moved the POI 3.17 jar to that folder. [It only makes sense since all 3 apps will need the functionality].
-- I created an Application.cfc in the "shared" folder with the following minimal code:
<cfcomponent output="false">
<cfset this.name = "sharedApp" />
<cfset this.javaSettings.loadPaths = [ './_jars' ]>
<cfset this.javaSettings.reloadOnChange = true>
</cfcomponent>
-- In my application's Application.cfc file, I prepended that newly created jar folder path to the this.javaSettings.loadPaths array:
this.javaSettings.loadPaths = [ '/shared/_jars', './_classes' ];
this.javaSettings.reloadOnChange = true;
-- Restarted the ColdFusion server.
It looks like everything is working as expected. @Charlie Arehart , @BKBK thank you very much in helping me get this fixed.