I'm sure I'm missing it somewhere, but how do you ...
# box-products
b
I'm sure I'm missing it somewhere, but how do you change the webroot of a CF server in CommandBox?
b
@Brian The webroot by default is whatever folder you started the server in.
Copy code
cd /path/to/my/webroot
server start
Are you perhaps asking to have the webroot in another folder other than where the
server.json
lives?
As far as existing servers once they've been started, you can't "change" the web root as the internal ID is based on that. You can start a second server however in the correct folder and forget the first one.
b
I'm sorry, yes, I'm trying to change it from the default.
b
The CF server is fine where it's at, I just want to point it to a different document root. I could copy all of the existing files over to the default webroot, but those aren't backed up in the cloud because of where they're at.
b
I... have no clue what your asking, lol
The web root is what we're talking about here, no?
That's exactly what those docs are talking about
CommandBox doesn't really care where the files are. If you have a server you previously started in
Copy code
C:/someFolder
and now you want to be in
Copy code
C:/anotherFolder
then stop/forget the first server and go start it again in the new location.
b
So the server home is in one place and the webroot is in another. The server home is fine where it is. It's where the CF code lives that I want to change.
b
the default webroot
I'm not sure what you mean by that. There isn't a "default web root" in a CommandBox server like there historically was in the ACF Tomcat-based installations (unless you're using mod_cfml)
Forget about the server home-- it doesn't matter where it lives, it's an implementation detail and it will go away when you forget the old server anyway
Just go start the new server in the folder where the code needs to live
It's that simple šŸ™‚
b
Okay, I'll try that and report back. šŸ™‚
b
If you are about the name of the server being something specific • make sure the name is in the server.json, incase the new folder is called something different • make sure you forget the old server first so the new one isn't called
myName2
I'm also assuming you're using CFConfig to manage your CF config so it will all carry over to the new server
b
A bold assumption! lol
b
Well, if not, just run
Copy code
install commandbox-cfconfig
cfconfig export .cfconfig.json
in the root of the old server before moving/forgetting it šŸ™‚
b
The install seems to run fine but the export command results in "Command "cfconfig export .cfconfig.json" cannot be resolved."
b
Reload commandbox
The current stable release has a bug that doesn't fully activate new modules all the way. This is fixed in 5.6 which will release soon
You can just run the
Copy code
reload
command and then your
cfconfig
namespace will be available
b
I get server errors when I reload CommandBox and they may be part of the problem. When I restart the server they don't show up, so I was hoping they were resolved. But I think my optimism may have been misplaced. One of the errors relates to cfconfig-services.
b
What errors do you get?
Remember, I can't see your screen šŸ™‚
b
Module [commandbox-cfconfig] failed to load! Check the logs for more info ( system-log | open ).
Cannot activate module: lucee-password-util
The module has not been registered, register the module first and then activate it.
C\Users\bjh1\.CommandBox\cfml\system\services\ModuleService.cfc414
Module [cfconfig-services] failed to load! Check the logs for more info ( system-log | open ).
Cannot activate module: lucee-password-util
The module has not been registered, register the module first and then activate it.
C\Users\bjh1\.CommandBox\cfml\system\services\ModuleService.cfc414
b
When I restart the server they don't show up
Starting a server has nothing to do with starting the CLI, so I don't quite understand what that means
b
It means I was being really optimistic. lol
b
Hmm, never seen that before. Did the install work correctly?
What version of Commandbox are you on?
b
5.5.2
b
Weird, perhaps uninstall and reinstall that module and make sure you get a clean installation
Copy code
uninstall commandbox-cfconfig --system
reload
install commandbox-cfconfig --verbose
b
Okay, I'll give that a whirl
The uninstall/install was a big success. That batch of three errors is gone. The export failed though with "Access is denied caused by: java.io.IOException Access is denied"
b
Is there more to the error message than that?
Like stack trace?
b
C\Users\bjh1\.CommandBox\cfml\modules\commandbox cfconfig\modules\cfconfig services\models\providers\JSONConfig.cfc line 92 90: // Ensure the parent directories exist 91: directoryCreate( path=getDirectoryFromPath( thisCFHomePath ), createPath=true, ignoreExists=true ); 92: fileWrite( thisCFHomePath, JSONPrettyPrint.formatJson( thisConfigRaw ) ); 93: return this; 94: } called from C\Users\bjh1\.CommandBox\cfml\modules\commandbox cfconfig\modules\cfconfig services\models\CFConfigService.cfc line 287 called from C\Users\bjh1\.CommandBox\cfml\modules\commandbox cfconfig\commands\cfconfig\export.cfc line 176 called from C\Users\bjh1\.CommandBox\cfml\system\services\CommandService.cfc line 443 called from C\Users\bjh1\.CommandBox\cfml\system\services\CommandService.cfc line 225 called from C\Users\bjh1\.CommandBox\cfml\system\Shell.cfc line 819 called from C\Users\bjh1\.CommandBox\cfml\system\Shell.cfc line 634 called from C\Users\bjh1\.CommandBox\cfml\system\Bootstrap.cfm line 160 lucee.runtime.exp.NativeException: Access is denied at java.base/java.io.WinNTFileSystem.createFileExclusively(Native Method) at java.base/java.io.File.createNewFile(Unknown Source) at lucee.commons.io.res.type.file.FileResource.getOutputStream(FileResource.java:261) at lucee.runtime.functions.file.FileStreamWrapperWrite._getOS(FileStreamWrapperWrite.java:138) at lucee.runtime.functions.file.FileStreamWrapperWrite.write(FileStreamWrapperWrite.java:69) at lucee.runtime.functions.file.FileWrite.call(FileWrite.java:51) at lucee.runtime.functions.file.FileWrite.call(FileWrite.java:33) at models.providers.jsonconfig_cfc$cf.udfCall(/cfconfig-services/models/providers/JSONConfig.cfc:92) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:350) at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:697) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:585) at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1932) at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787) at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1762) at models.cfconfigservice_cfc$cf.udfCall1(/cfconfig-services/models/CFConfigService.cfc:287) at models.cfconfigservice_cfc$cf.udfCall(/cfconfig-services/models/CFConfigService.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:350) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:213) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:698) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:585) at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1951) at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:866) at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1781) at cfml.modules.commandbox_cfconfig495.commands.cfconfig.export_cfc$cf.udfCall(/C__Users_bjh1__CommandBox/cfml/modules/commandbox-cfconfig/commands/cfconfig/export.cfc:176) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:350) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:213) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:698) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:585) at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1951) at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:866) at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1781) at system.services.commandservice_cfc$cf.udfCall1(/commandbox/system/services/CommandService.cfc:443) at system.services.commandservice_cfc$cf.udfCall(/commandbox/system/services/CommandService.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:350) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:213) at lucee.runtime.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:804) at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:866) at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1781) at system.services.commandservice_cfc$cf.udfCall1(/commandbox/system/services/CommandService.cfc:225) at system.services.commandservice_cfc$cf.udfCall(/commandbox/system/services/CommandService.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:350) at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:697) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:585) at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1932) at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787) at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1762) at system.shell_cfc$cf.udfCall4(/commandbox/system/Shell.cfc:819) at system.shell_cfc$cf.udfCall(/commandbox/system/Shell.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:350) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:213) at lucee.runtime.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:804) at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:866) at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1781) at system.shell_cfc$cf.udfCall3(/commandbox/system/Shell.cfc:634) at system.shell_cfc$cf.udfCall(/commandbox/system/Shell.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:350) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:213) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:698) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:585) at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1951) at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:866) at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1781) at users.bjh1._commandbox46.cfml.system.bootstrap_cfm$cf.call(/Users/bjh1/.CommandBox/cfml/system/Bootstrap.cfm:160) at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:1043) at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:935) at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:916) at 1rxzf3518nyvy.call(Unknown Source) at lucee.runtime.compiler.Renderer.tag(Renderer.java:107) at lucee.runtime.compiler.Renderer.script(Renderer.java:97) at lucee.runtime.jsr223.ScriptEngineImpl.eval(ScriptEngineImpl.java:65) at lucee.runtime.jsr223.ScriptEngineImpl.eval(ScriptEngineImpl.java:220) at cliloader.LoaderCLIMain.execute(LoaderCLIMain.java:328) at cliloader.LoaderCLIMain.execute(LoaderCLIMain.java:155) at cliloader.LoaderCLIMain.main(LoaderCLIMain.java:580) Caused by: java.io.IOException: Access is denied ... 83 more
b
Seems pretty straightfoward
Whatever user the CLI is running as can't write the JSON file
Which could be permissions-related or perhaps the file is already there and open/locked in another program
This is the part where you get to troubleshoot on your own šŸ™‚
b
lol
Can you specify where it exports the file to?
b
Of course
If you just run
Copy code
cfconfig export .cfonfig.json
then it will write to the current working directory of the shell
Which, if you don't' have
commandbox-bullet-train
installed, you can see with
Copy code
pwd
b
Okay, I'll mess around with that for a bit. Thanks for all your help!