I have been banging my head against the wall for a few days nowβ¦
I am moving a few projects over to a new Mac (running Ventura 13.1). One of these sites uses cfconfig
to set up a datasource, some mappings, and object cache. However, the config file does not get read and the server starts without these being created.
I have a file named serverConfig.json
in the same folder as my server.json
file and in server.json
I have the following:
"cfconfig":{
"server":"./serverConfig.json"
}
This same configuration worked without issue on my Windows machine.
I have already made sure I do not have any duplicate server instances. I even uninstalled cfconfig and reinstalled, but the file is never read.
Thoughts?
Hmm. I would try:
- Playing with a few different configuration keys:
cfconfig.file
or CFConfigFile
, just in case your CommandBox version is super old and doesnβt support cfconfig.server
- Posting your CommandBox version.
- Dropping the
./
from the file path.
- Do
server start --verbose
and watch for any cfconfig output
Obligatory link to docs (Yes, you probably checked this already):
So right off, use the --verbose
flag when starting your server. There is an entire CFConfig section in the output that tells you exactly what JSON files itβs loading (example below). And, like Michael said, make sure youβve got the latest version of everything.
I just tested this locally with these commands
β― echo {} > mySettings.json
β― server set cfconfig.server=mySettings.json
Set cfconfig.server = mySettings.json
β― server start --verbose
And I had the following output in the console
| |--------------------------------------------------------------
| β | Loading CFConfig into server
| |-------------------------------------------
| | Found CFConfig JSON in "CFConfig.server" server.json key.
| | Importing luceeserver config from [C:\Users\Brad\Desktop\sandbox\installtest\mySettings.json]
| | Config transferred from C:\Users\Brad\Desktop\sandbox\installtest\mySettings.json!
I am using CommandBox 5.7.0+00653.
I have tried different pathing to the file, including an absolute path.
I have tried starting the server with --verbose
and I do not see anything about cfconfig data being loaded.
Here is what I see when I start the sever with --verbose
β | Starting Server |------------------------------
| Looking for server JSON file by convention: /my/path/projects/golf-league//server-golf-league.
| jso
| webroot pulled from server's JSON: /my/path/projects/golf-league/wwwapp/www/
| Adding host 'mydomain.local' to your hosts file!
| start server in - /my/path/projects/golf-league/wwwapp/www/
| server name - golf-league
| server config file - /my/path/projects/golf-league//server-golf-league.json
| Contacting ForgeBox to determine the latest & greatest version of [lucee 5.3.9]... Use an exact 'c
| fengine' version to skip this check
| OK, [lucee 5.3.9+166] it is!
| WAR/zip archive already installed.
| Server start command:
| /bin/bash /private/var/root/.CommandBox/cfml/system/modules_app/server-commands/bin/server_spaw
| ner.sh /my/path/projects/_servers/league//nohup.log /opt/homebrew/Cellar/openjdk@11/11.0.18/li
| bexec/openjdk.jdk/Contents/Home/bin/jav
| -jar /private/var/root/.CommandBox/lib/runwar-4.7.16.jar
| --background=true
| --host mydomain.local
| --stop-port 63597
| --processname golf-league [lucee 5.3.9+166]
| --log-dir /my/path/projects/_servers/league//logs
| --server-name golf-league
| --tray-enable false
| --dock-enable true
| --directoryindex true
| --timeout 240
| --proxy-peeraddress false
| --cookie-secure false
| --cookie-httponly false
| --pid-file /my/path/projects/_servers/league//.pid.txt
| --tray-icon /private/var/root/.CommandBox/cfml/system/config/server-icons/trayicon-lucee.png
| --gzip-enable true
| --cfengine-name lucee
| --jvm-args=-Xmx1024m;-Djdk.io.File.enableADS=true
| -war /my/path/projects/golf-league/wwwapp/www/
| --web-xml-path /my/path/projects/_servers/league//WEB-INF/web.xml
| --http-enable true
| --ssl-enable false
| --ajp-enable false
| --http2-enable true
| --open-browser true
| --open-url http://mydomain.local:1467
| --port 1467
| --urlrewrite-enable true
| --client-cert-trust-headers false
| --urlrewrite-file /private/var/root/.CommandBox/cfml/system/config/urlrewrite.xml
| --predicate-file /my/path/projects/_servers/league//.predicateFile.txt
| The server for /my/path/projects/golf-league/wwwapp/www/ is starting on http://mydomain.local:1467 ..
|------------------------------
| β | Setting Server Profile to [development]
| |------------------------------------------------------
| | Profile set from server bound to localhost
| | Block CF Admin disabled
| | Block Sensitive Paths enabled
| | Block Flash Remoting enabled
| | Directory Browsing enabled
| | File Caching disabled
| |------------------------------------------------------
[INFO ] Runwar: ******************************************************************************
[INFO ] Runwar: Starting RunWAR 4.7.16
[INFO ] Runwar: Binding HTTP on mydomain.local:1467
[INFO ] Runwar: Enabling HTTP/2
[INFO ] Runwar: Starting background golf-league [lucee 5.3.9+166] from: /private/var/root/.CommandBox/lib/runwar-4.7.16.jar
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by runwar.LaunchUtil (file:/private/var/root/.CommandBox/lib/runwar-4.7.16.jar) to method java.lang.ProcessImpl.pid()
WARNING: Please consider reporting this to the maintainers of runwar.LaunchUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO ] Starting in background -
As I noted, I have reinistalled cfconfig several times already.
I seem to run into weird issues like this every time I need to create a new project or move a project to a new machine. It is quite frustrating.
Hmm, based on that output, it would certainly appear CFConfig isnβt installed at all. Can you tell us about your setup? Is CommandBox running inside of a Docker container? A VM? Did you use the same user to run CommandBox when installing CFConfig as the user that is being used to start the server? For example
box foo
and
sudo box foo
Will create two CommandBox homes, one for root and one for your normal user. I would try running something like
cfconfig help
just to ensure the module is installed (you should get command help, not an error) and then also run
info
to confirm what user box is running as as well as the CommandBox home directory. Does it match the /private/var/root/.CommandBox/
path that the server is using (from your output above)?
Also, the CFConfig module should be installed under /private/var/root/.CommandBox/cfml/modules/commandbox-cfconfig
. Make sure you installed commandbox-cfconfig
and not the cfconfig
services. You can also check what system modules are installed by running
list --system
and you should see something like (note, it starts with commandbox-cfconfig
as the top-most item.
βββ¬ commandbox-cfconfig (1.10.3)
ββ¬β cfconfig-services (1.18.5)
βββ lucee-password-util (1.0.3)
βββ¬ coldbox (4.3.0+188)
β βββ testbox ()
βββ testbox ()
βββ¬ JSONPrettyPrint (1.4.1)
β βββ coldbox ()
β βββ testbox ()
βββ¬ adobe-password-util (1.0.8)
β βββ propertyFile (1.2.0)
βββ¬ semver (1.2.4)
β βββ testbox ()
βββ propertyFile (1.2.0)
among the output.
1 Like
I installed CommandBox using Homebrew.
You nailed the issue, though.
I was using sudo
because of permissions issues. When I ran
sudo box install commandbox-cfconfig
It installed CfConfig (again) and I can now see the settings being applied when I start the server.
1 Like
You can avoid the whole two-different-box-homes scenario with a commandbox.properties
file as described here
Then, no matter what user is running box, they will share the same home dir. You just have to ensure itβs a folder that everyone has permissions to.