4

Background

From ColdFusion 10 onward it is possible to include JARs from a custom location.

To load custom Java libraries (or .java files) code similar to the following is added to Application.cfc

this.javaSettings = {LoadPaths = [".\java_lib\",".\java\myjar.jar"], loadColdFusionClassPath = true, reloadOnChange = false} 

Or to pickup changes (with a default 60 second refresh time) the following is added

this.javaSettings = {LoadPaths = [".\java_lib\",".\java\myjar.jar"], loadColdFusionClassPath = true, reloadOnChange = true} 

Question

For development the second option is good (probably with a much lower refresh time). For production the first option would be ideal, but restarting the server every time we need to change any java code is not acceptable. Is there any way to trigger a reload of java classes (preferably programmatic) without restarting the server when reloadOnChange = false is set?

1
  • 1
    restarting the server every time we need to change any java code I am not 100% positive, but ... IIRC it should only require restarting the application, not the whole server. Did you try it? (I realize that is not as granular as you are looking for, but AFAIK CF does not expose any methods for reloading on demand.) Commented Apr 15, 2015 at 16:38

1 Answer 1

1

I would suggest using this instead:

https://github.com/markmandel/JavaLoader

Sign up to request clarification or add additional context in comments.

2 Comments

If it comes to it I may do that, although it's slightly damning of the CF10 functionality if it still can't really be used in production
@RichardTingle - I am not sure it is as simple as we may be thinking ... .. Given that it involves dynamic class loaders, there may be some technical limitations involved, depending on the implementation. RE: JavaLoader.cfc - Last I checked it was recommended the JavaLoader be stored in the server scope to avoid memory leaks with URLClassLoaders. Not sure how/if the issue relates to the CF10 feature as well (since it uses dynamic class loaders too).

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.