[CommandBox 4.7.0+00026] - Server settings not imported when server starts

I am trying to set up cfconfig to manage datasources and mappings in my development environment to make it easier to verify different versions of Lucee work with my code base.

I am using CommandBox 4.7.0+00026, commandbox-cfconfig 1.0.3 and Lucee 5.3.2+77

When the server starts, the datasource is not configred, nor are any of the mappings.

However, when I use cfonfig show I see the datasource and mapping in the results - but nothing on the Lucee server itself.

I have tried using the cfconfigfile parameter in server.json and I have tried putting .config.json in the web root and neither produces the expected results.

Here is the json I am using:

{
“CFMappings”:{
“/ui”:{
“PHYSICAL”:“path\to\folder”,
“PRIMARY”:“physical”,
“READONLY”:“false”
}
},
“clientCookies”:“no”,
“clientManagement”:“no”,
“datasources”:{
“golfLeagueManager”:{
“allowAlter”:true,
“allowCreate”:true,
“allowDelete”:true,
“allowDrop”:true,
“allowGrant”:true,
“allowInsert”:true,
“allowRevoke”:true,
“allowSelect”:true,
“allowUpdate”:true,
“blob”:“true”,
“class”:“com.mysql.jdbc.Driver”,
“clob”:“true”,
“connectionTimeout”:“1”,
“custom”:“useUnicode=true&characterEncoding=UTF-8&useLegacyDatetimeCode=true”,
“database”:“golf_league_manager”,
“dbdriver”:“MySQL”,
“dsn”:“jdbc:mysql://{host}:{port}/{database}”,
“host”:“localhost”,
“metaCacheTimeout”:“60000”,
“password”:"***",
“port”:“3306”,
“storage”:“false”,
“username”:“root”,
“validate”:“false”
}
},
“sessionManagement”:“yes”,
“sessionTimeout”:“0,0,30,0”,
“timeServer”:“pool.ntp.org
}

Is there some kind of comparability issue with Lucee? I have used this for projects that use ACF and did not have these issues.

FWIW - I am seeing the same behavior in Lucee 5.2.6.59

I was able to get this working with 5.2.6.59 but it the datasource and mapping do not get created with 5.3.2.77.

The issue is likely that the JDBC driver class changed from Lucee 5.2 and Lucee 5.3. Lucee will ignore any datasources usually that point to a class it can’t find. Try removing the class entirely from the JSON and let CFConfig default it.

As far as mappings also not showing up, I’m not sure about that. A first step would be to confirm that the import is actually happening. In order for CFConfig to automatically import the JSON file on startup, it needs to be in the web root and called “.cfconfig.json” or if it’s elsewhere, your server.json needs to point to it. Do a “start --debug” and you should see a green line of output that says “Config transferred” when the server is starting. If you don’t see that, then CFConfig never fired on server start.

If you’ve manually imported the settings to a running server, you would need to restart the server to pick up the changes to the config files.

I verified the file was being read by using start --debug.

image.png

I removed the class from the datasource definition in my cfconfig file but it still does not get created when the server starts when using Luce 5.3.2+77, but it does when I use Lucee 5.2.6.59 .

It seems that even though the config file is read, nothing gets used. If I remove the datasource block completely, the mapping still doesn’t get created in Lucee 5.3.2+77.

Any chance the settings are being imported into the server context and you’re looking for them in the web context? Perhaps you can send me a copy of the JSON file and I can test. If “cfconfig show” shows the settings, then it would seem they’ve been written to the Lucee XML files. The only other thing I could think of is if CommandBox has managed to get two servers with the same name and is confused, writing the config to the wrong place. You can confirm that with “server list”.

image.png

No chance at all. I have checked both web & server context. As I mentioned, this works as expected in the older version of Lucee.

Here is the cfconfig I last tested with.

{
“applicationTimeout”:“1,0,0,0”,
“CFMappings”:{
“/ui”:{
“PHYSICAL”:“D:\Path\to\folder”,
“PRIMARY”:“physical”,
“READONLY”:“false”
}
},
“clientCookies”:“no”,
“clientManagement”:“no”,

“sessionManagement”:“yes”,
“sessionTimeout”:“0,0,30,0”,
“timeServer”:“pool.ntp.org
}

image.png

Scott, I created a .cfconfig.json file in an empty folder and pasted in your JSON from above. Then I started up a Lucee 5.3.2.77 server in that folder

start cfengine=lucee

Each of the items from the JSON file imported into the server and are visible from the server context including the timeouts, client settings, and the /ui CF Mapping.

image.png

That does not really mimic my set up.

Seems odd that it works in older versions of Lucee for me but not the latest.

image.png

I tried moving the settings to a .config.json file in the web root.
I started the server using --debug
I see this in the console:

Found CFConfig file by convention in webroot.
CFConfig file set to [D:/Sites/Golf League Manager/wwwapp/www//.cfconfig.json].
Importing CFConfig into server [Golf League Manager]
Config transferred!

None of the items from the JSON file get created.

image.png

The only thing I can think of then is that you have two servers of the same name and CommandBox is confused between the two. I suggested this a couple of replies ago. Did you check for that scenario? You can get a full list of all servers with “server list” or filter only servers in a given directory with “server list --local”. In your case, we’re specifically looking to see if you have two servers called “Golf League Manager”.

image.png

There were multiple servers with the same name for soem reason.

I removed all the servers where the name ended in ‘Golf League Manager’ and I also used a new/unique name in server.json and that seems to have fixed the problem.

image.png