I called "hello.cfm" from my browser and I noticed that Application.cfc's onCFCRequest() gets fired only if the "test.cfc" is present within the "test" folder because that is where Application.cfc is present. It doesn't get fired if I were to place "test.cfc" within a folder called "shared" outside of "test". The excel.cfc (mentioned in the original post) is present outside of my application, in a folder called "shared/cf". It is in that folder because 2 other ColdFusion applications make of use of shared stuff including excel.cfc from that folder.
By @skallaje
@skallaje , I think you've got us barking up the wrong tree. There are no issues with ColdFusion's this.javaSettings. I shall demonstrate it conclusively in a moment. It means that the issue you're facing is the result of a mistake in your paths, settings or code.
The first likely mistake could be in your paths. You say, "The excel.cfc (mentioned in the original post) is present outside of my application." This statement contains a clue. Your application is essentially defined by its Application.cfc file. If excel.cfc is outside the application, it won't be able to "see" the this.javaSettings in Application.cfc.
From your original description, I had taken it for granted that the Application.cfc file containing the this.javaSettings code is in the same directory as the component excel.cfc. That is, in your cf directory. So, you should place it -- or move it -- there. Alternatively, place it one directory up, in /shared.
The second likely mistake could be in your code. You write, "I created a folder called "test". Added a bare minimum, skeletal "Application.cfc" in it.". Does the "test" folder include the directory /shared? That is not clear from your test-request,
$.post("/shared/test.cfc?method=addNumbers"
Also, could you share the code of the skeletal Application.cfc?
I shall provide in the next post a test involving ColdFusion's this.javaSettings. The test is constructed to be as close to your scenario as possible. It shows that, in spite of what we at first thought, ColdFusion's this.javaSettings actually works as expected. That is:
When the context is an HTTP CFC request, ColdFusion does not default to loading the application's default libraries. It will load your custom libraries instead, if the requested CFC has access to the Application.cfc that defines this.javaSettings.
ColdFusion does not treat an HTTP request as a new, independent request context. It treats it as it would any internal createObject() instantiation. The key is that the class loader will honour the this.javaSettings configuration of the Application.cfc file that is in effect.
... View more