2
votes

I am wondering if there is an easy way of deploying a .jar easily without restarting the service? I found a couple different posts but they are a little bit old and they mention using a library called JavaLoader Programmatic reloading of Java JARs without restarting ColdFusion Is there an alternative to doing this? I am developing with a java sdk and it is very time consuming to keep restarting after every change and I would prefer not to use a library just to accomplish this.

Edit: I am using Lucee 5.2

1
You might want to mention what flavor (Adobe or Lucee) and what version of it you are running. I believe it was Adobe ColdFusion 10 that introduced the ability to dynamically load JAR files (but not by default) - Enhanced Java integration in ColdFusion (notice the reloadOnChange attribute) - Miguel-F
@Miguel-F updated details - Yamaha32088
In Lucee you should also be able use the javasettings property in Application.cfc to load jars and detect changes, but there seems to be a bug with the reloadOnChange attribute in Lucee. - CfSimplicity

1 Answers

4
votes

For Lucee, Javaloader is the way to go. https://github.com/markmandel/JavaLoader. The library might be a little old, but so is ColdFusion. Javaloader has never been replaced because it works really well and a replacement isn't needed. The developer, Mark Mandel, is a very smart guy who works for Google now. You can see what he's up to at https://twitter.com/Neurotic.

Javaloader is easy to use once you understand how to configure it. It accepts an array of paths to your Java libraries. Once it is configured, use javaloader.create() to call your classes:

jars = [ expandPath( "/classes/mypackage.jar" ) ];
javaloader = createObject("component", "javaloader.JavaLoader").init( sourceDirectories = jars );
myclass = javaloader.create( "myclass" ).init();