How to configure your default cfengine on commandbox

Published: {ts '2020-04-28 00:00:00'}
Author: Steven Neiland
Site Url: http://www.neiland.net/article/how-to-configure-your-default-cfengine-on-commandbox/

I've been doing react development for the last year which has kept me away from cf and cf related tools. Needless to say I'm a bit rusty which was highlighted last week when I went to configure commandbox and testbox for a new side project and almost immediately ran into problems.

Lucee was not able to load a Agent dynamically! You need to load one manually by adding the following to your JVM arguments [-javaagent:"/home/sneiland/.CommandBox/server/2D6DCF4952D4071DCB5C19728539514A-cf/lucee-5.2.9.31/WEB-INF/lucee-server/context/lucee-external-agent.jar"

After a quick query out to the box-products channel on slack Brad Wood was able to diagnose that there was an issue with the version of java I was running "openjdk11" and that particular version of lucee 5.2.9. All I had to do was simply run the 5.3 version of lucee instead. Simple right, except my brain had decided to drop all information about how to configure commandbox by this time. Fortunately Brad being the gentleman he is, he walked me through the config. So for future reference:

Running a Specific Version of an Engine

If you want to run a specific engine and version on commandbox all you need to do is append the attribute cfengine={enginename}@{version} to your box start command. ie.

box start [email protected]

This will update your server.json file with that engine and version. The next time you run "box start" it should just remember that selection so you don't need to specify the version each time.

Configure a global default engine

Now maybe it is the case that you want to configure a global default engine as opposed to a application specific default. This can be handy where you are working with multiple repositories and may not be permitted (for "reasons") to update/add an app engine default in a projects server.json file. Fortunately commandbox allows for this also.

box config set [email protected]

Hopefully now I've written that down I wont have to go bothering Brad again....about this anyway :)