Lucee admin not found commandbox

Just did a fresh install of commandbox v5.2.1+00295 on a pi4.

Lucee is running and will server pages.

Trying to get to lucee admin: http://localhost/lucee/admin/server.cfm

I get a “Not Found”.

box server list:
http://0.0.0.0:80
CF Engine: lucee 5.3.7+47

Any Ideas?

@nalbee CommandBox 5.2 implemented new secure by default settings which blocks the admin if it can’t detect it’s in development mode.

This was covered in the 5.2 release notes under “breaking changes”:

If this is a development server, just set the profile property in your server.json to development

server set profile=development

or if this is a staging/prod server and you just want the admin visible, you can turn just that setting off

server set web.blockCFAdmin=false

Also, if you were to do a --trace start and tail the console, you’d see the debugging messages showing you that path being blocked

1 Like

Thanks so much. I couldn’t find why via google and the online docs. I really appreciate your reply.

Nate

1 Like

Just to let you know if you don’t know about it already. If there is something I can do to correct it, let me know.

I get errors when server set profile=development is set. When I set it back to profile=production the error goes away.

If I run box, then, start the server, in box I can get it to start while using profile=development.

× | Starting Server
   | > key [STOPSOCKET] doesn't exist
   |------------------------------
                                                                                                                                                                                      ERROR (5.2.1+00295)                                                                                                                                                                   

key [STOPSOCKET] doesn't exist


/system/services/ServerService.cfc: line 2142
2140:  	 **/
2141: 	function isServerRunning( required struct serverInfo ){
2142: 		var portToCheck = serverInfo.stopSocket;
2143: 		if( serverInfo.HTTPEnable ) {
2144: 			portToCheck = serverInfo.port;
called from /system/services/ServerService.cfc: line 283
called from /system/modules_app/server-commands/commands/server/start.cfc: line 173
called from /system/services/CommandService.cfc: line 345
called from /system/services/CommandService.cfc: line 158
called from /system/Shell.cfc: line 770
called from /system/Bootstrap.cfm: line 119

@nalbee Hmm, that’s rather odd. Not only is the stop socket logic completely separate from the profile logic, the stopSocket struct is should be guaranteed to always exist in the code. Perhaps you can jump onto Slack so we can troubleshoot it together. I’d start by looking to see if stopSocket is defined here:

server info --json
# or....
server info property=stopSocket

Also, are you setting any sort of custom stop socket in your server.json?

Looking at it more for some reason I think .CommandBox/servers.json might be getting corrupted. If I delete and recreate the file before I start, no problems. It’s a bit weird because it happens every-time I server start or stop .

I’m running command box on pi’s with usb boot so that’s a bit unusual as far as use cases go. I’ve noticed over the last year of using CommandBox that servers.json is a weak point that in its reliability. This might be of use to you:

I start commandBox using systemd on boot. So this is how I fixed it today. Seems to work for start , stop and restart. Adding “wants” to commandBox.service is key below for this to work.

If there was an option in commandBox to delete the servers.json every-time that would be great. I’m certainly not an expert in CommandBox. If that exists I’ve missed it.

I’m in and out all day so Slack would be hard for me to do. If you want to run/debug anything just let me know. I appreciate how available you make yourself to the community.

nano /usr/lib/systemd/system/commandBox.service

[Unit]
Description=delete commandbox serverjson

[Service]
ExecStart=/usr/bin/rm /root/.CommandBox/servers.json
Type=forking

[Install]
WantedBy=multi-user.target


nano /usr/lib/systemd/system/commandBox.service

[Unit]
Description=CommandBoxServer
After=delCmdBoxJson.service
After=network.target
Wants=delCmdBoxJson.service

[Service]
ExecStart=/usr/local/bin/box server start /root/web/server.json
Type=forking

[Install]
WantedBy=multi-user.target

I provided two commands for you to run above. Did you see them?

Usually, when a JSON file gets corrupted, it’s just trashed and can’t be read at all. I’ve not seen a file get corrupted but still be JSON and just be missing keys. That would be a pretty fantastic coincidence. Do you have more than one server you’re starting at once? I also asked some other questions above you haven’t answered yet. They still stand.

Sorry for the delay, here is the rundown.

Shut down via systemctl then on restart via cmdline:
/usr/local/bin/box server start /root/pollmodbus/server-pollmodbus.json

 
 × | Starting Server
   | > key [STOPSOCKET] doesn't exist
   |------------------------------
                                                                                                                                                    ERROR (5.2.1+00295)                                                                                                                                 

key [STOPSOCKET] doesn't exist


/root/.CommandBox/cfml/system/services/ServerService.cfc: line 2142
2140:  	 **/
2141: 	function isServerRunning( required struct serverInfo ){
2142: 		var portToCheck = serverInfo.stopSocket;
2143: 		if( serverInfo.HTTPEnable ) {
2144: 			portToCheck = serverInfo.port;
called from /root/.CommandBox/cfml/system/services/ServerService.cfc: line 283
called from /root/.CommandBox/cfml/system/modules_app/server-commands/commands/server/start.cfc: line 173
called from /root/.CommandBox/cfml/system/services/CommandService.cfc: line 345
called from /root/.CommandBox/cfml/system/services/CommandService.cfc: line 158
called from /root/.CommandBox/cfml/system/Shell.cfc: line 770
called from /root/.CommandBox/cfml/system/Bootstrap.cfm: line 119

lucee.runtime.exp.ExpressionException: key [STOPSOCKET] doesn't exist
	at lucee.runtime.type.util.StructSupport.invalidKey(StructSupport.java:67)
	at lucee.runtime.type.StructImpl.get(StructImpl.java:149)
	at lucee.runtime.util.VariableUtilImpl.get(VariableUtilImpl.java:278)
	at lucee.runtime.PageContextImpl.get(PageContextImpl.java:1502)
	at system.services.serverservice_cfc$cf.udfCall4(/commandbox/system/services/ServerService.cfc:2142)
	at system.services.serverservice_cfc$cf.udfCall(/commandbox/system/services/ServerService.cfc)
	at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)
	at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)
	at lucee.runtime.type.UDFImpl.call(UDFImpl.java:217)
	at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:779)
	at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:785)
	at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1710)
	at system.services.serverservice_cfc$cf.udfCall1(/commandbox/system/services/ServerService.cfc:283)
	at system.services.serverservice_cfc$cf.udfCall(/commandbox/system/services/ServerService.cfc)
	at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)
	at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)
	at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:207)
	at lucee.runtime.ComponentImpl._call(ComponentImpl.java:681)
	at lucee.runtime.ComponentImpl._call(ComponentImpl.java:568)
	at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1917)
	at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:864)
	at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1729)
	at system.modules_app.server_commands315.commands.server.start_cfc$cf.udfCall(/commandbox/system/modules_app/server-commands/commands/server/start.cfc:173)
	at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)
	at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)
	at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:207)
	at lucee.runtime.ComponentImpl._call(ComponentImpl.java:681)
	at lucee.runtime.ComponentImpl._call(ComponentImpl.java:568)
	at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1917)
	at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:864)
	at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1729)
	at system.services.commandservice_cfc$cf.udfCall1(/commandbox/system/services/CommandService.cfc:345)
	at system.services.commandservice_cfc$cf.udfCall(/commandbox/system/services/CommandService.cfc)
	at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)
	at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)
	at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:207)
	at lucee.runtime.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:792)
	at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:864)
	at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1729)
	at system.services.commandservice_cfc$cf.udfCall1(/commandbox/system/services/CommandService.cfc:158)
	at system.services.commandservice_cfc$cf.udfCall(/commandbox/system/services/CommandService.cfc)
	at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)
	at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)
	at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:207)
	at lucee.runtime.ComponentImpl._call(ComponentImpl.java:681)
	at lucee.runtime.ComponentImpl._call(ComponentImpl.java:568)
	at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1917)
	at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:864)
	at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1729)
	at system.shell_cfc$cf.udfCall4(/commandbox/system/Shell.cfc:770)
	at system.shell_cfc$cf.udfCall(/commandbox/system/Shell.cfc)
	at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)
	at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)
	at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:207)
	at lucee.runtime.ComponentImpl._call(ComponentImpl.java:681)
	at lucee.runtime.ComponentImpl._call(ComponentImpl.java:568)
	at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1917)
	at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:864)
	at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1729)
	at _commandbox46.cfml.system.bootstrap_cfm$cf.call(/__commandbox_root/.CommandBox/cfml/system/Bootstrap.cfm:119)
	at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:945)
	at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:837)
	at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:818)
	at 1hakaskpj4qmq.call(Unknown Source)
	at lucee.runtime.compiler.Renderer.tag(Renderer.java:108)
	at lucee.runtime.compiler.Renderer.script(Renderer.java:98)
	at lucee.runtime.jsr223.ScriptEngineImpl.eval(ScriptEngineImpl.java:63)
	at lucee.runtime.jsr223.ScriptEngineImpl.eval(ScriptEngineImpl.java:194)
	at cliloader.LoaderCLIMain.execute(LoaderCLIMain.java:330)
	at cliloader.LoaderCLIMain.execute(LoaderCLIMain.java:155)
	at cliloader.LoaderCLIMain.main(LoaderCLIMain.java:580)

Running commands

box server info property=stopSocket
36505

box server info --json 
{
    "accessLogPath":"/root/.CommandBox/server/serverHome/lucee-5.3.7.47/logs/access.txt",
    "SSLKeyFile":"",
    "webXML":"/root/.CommandBox/server/serverHome/lucee-5.3.7.47/WEB-INF/web.xml",
    "rewritesStatusPath":"",
    "basicAuthEnable":"true",
    "customServerFolder":"/root/.CommandBox/server/serverHome",
    "trayOptions":[
        {
            "image":"/root/.CommandBox/cfml/system/config/server-icons/stop.png",
            "action":"stopserver",
            "label":"Stop Server"
        },
        {
            "shell":"/bin/bash",
            "command":"/usr/local/bin/box server restart 'pollmodbus'",
            "hotkey":"R",
            "image":"/root/.CommandBox/cfml/system/config/server-icons/restart.png",
            "workingDirectory":"/root/pollmodbus/",
            "action":"runAsync",
            "label":"Restart Server"
        },
        {
            "items":[
                {
                    "path":"/root/pollmodbus/",
                    "image":"/root/.CommandBox/cfml/system/config/server-icons/folder.png",
                    "action":"openfilesystem",
                    "label":"Webroot"
                },
                {
                    "path":"/root/.CommandBox/server/serverHome/lucee-5.3.7.47/",
                    "image":"/root/.CommandBox/cfml/system/config/server-icons/folder.png",
                    "action":"openfilesystem",
                    "label":"Server Home"
                },
                {
                    "url":"http://0.0.0.0:80",
                    "image":"/root/.CommandBox/cfml/system/config/server-icons/home.png",
                    "action":"openbrowser",
                    "label":"Site Home"
                },
                {
                    "url":"http://0.0.0.0:80/lucee/admin/server.cfm",
                    "image":"/root/.CommandBox/cfml/system/config/server-icons/server_settings.png",
                    "action":"openbrowser",
                    "label":"Server Admin"
                },
                {
                    "url":"http://0.0.0.0:80/lucee/admin/web.cfm",
                    "image":"/root/.CommandBox/cfml/system/config/server-icons/web_settings.png",
                    "action":"openbrowser",
                    "label":"Web Admin"
                }
            ],
            "image":"/root/.CommandBox/cfml/system/config/server-icons/open.png",
            "label":"Open..."
        },
        {
            "items":[
                {
                    "disabled":true,
                    "label":"Engine: lucee 5.3.7+47"
                },
                {
                    "path":"/root/pollmodbus/",
                    "image":"/root/.CommandBox/cfml/system/config/server-icons/folder.png",
                    "action":"openfilesystem",
                    "label":"Webroot: /root/pollmodbus/"
                },
                {
                    "url":"http://0.0.0.0:80",
                    "image":"/root/.CommandBox/cfml/system/config/server-icons/home.png",
                    "action":"openbrowser",
                    "label":"URL: http://0.0.0.0:80"
                },
                {
                    "disabled":true,
                    "label":"PID: ${runwar.PID}"
                },
                {
                    "disabled":true,
                    "label":"Heap: Not set"
                }
            ],
            "image":"/root/.CommandBox/cfml/system/config/server-icons/info.png",
            "label":"Info"
        }
    ],
    "javaVersion":"",
    "dateLastStarted":"December, 22 2020 10:01:00 -0600",
    "libDirs":"",
    "blockSensitivePaths":true,
    "debug":false,
    "basicAuthUsers":{},
    "SSLPort":"1443",
    "rewritesConfig":"/root/.CommandBox/cfml/system/config/urlrewrite.xml",
    "webroot":"/root/pollmodbus/",
    "WEBRULES":[
        "disallowed-methods( methods={trace,track} )",
        "regex( pattern='.*/(box.json|server.json|web.config|urlrewrite.xml|package.json|package-lock.json|Gulpfile.js)', case-sensitive=false ) -> { set-error(404); done }",
        "regex('/\\.') -> { set-error( 404 ); done }",
        "path-prefix( { '/JSDebugServlet','/securityanalyzer','/WSRPProducer' } ) -> { set-error( 404 ); done }",
        "regex( pattern='\\.jws$', case-sensitive=false ) -> { set-error( 404 ); done }",
        "path-prefix( { '/flex2gateway','/flex-internal','/flashservices/gateway','/cfform-internal','/CFFormGateway', '/openamf/gateway', '/messagebroker' } ) -> { set-error( 404 ); done }",
        "regex( pattern='\\.(mxml|cfswf)$', case-sensitive=false ) -> { set-error( 404 ); done }"
    ],
    "errorPages":{},
    "serverHome":"/root/.CommandBox/server/serverHome/lucee-5.3.7.47",
    "serverConfigDir":"/WEB-INF",
    "SSLCertFile":"",
    "rewritesLogPath":"/root/.CommandBox/server/serverHome/lucee-5.3.7.47/logs/rewrites.txt",
    "accessLogEnable":"false",
    "openBrowserURL":"http://0.0.0.0:80",
    "id":"serverHome",
    "dockEnable":"true",
    "minHeapSize":"",
    "rules":[],
    "trayEnable":"true",
    "exitCode":0,
    "runwarArgs":" ",
    "engineVersion":"5.3.7+47",
    "consolelogPath":"/root/.CommandBox/server/serverHome/lucee-5.3.7.47/logs/server.out.txt",
    "runwarUndertowOptions":{},
    "openBrowser":"true",
    "sessionCookieSecure":"false",
    "sessionCookieHTTPOnly":"false",
    "SSLEnable":"false",
    "stopSocket":36505,
    "logDir":"/root/.CommandBox/server/serverHome/lucee-5.3.7.47/logs",
    "AJPPort":"8009",
    "blockFlashRemoting":true,
    "rewritesLogEnable":"false",
    "trayicon":"/root/.CommandBox/cfml/system/config/server-icons/trayicon-lucee.png",
    "AJPEnable":"false",
    "runwarXNIOOptions":{},
    "status":"running",
    "statusInfo":{
        "ARGUMENTS":"/bin/bash /root/.CommandBox/cfml/system/modules_app/server-commands/bin/server_spawner.sh /root/.CommandBox/server/serverHome/lucee-5.3.7.47/nohup.log /usr/lib/jvm/java-11-openjdk-armhf/bin/java -jar /root/.CommandBox/lib/runwar-4.3.13.jar --background=true --host 0.0.0.0 --stop-port 36505 --processname pollmodbus [lucee 5.3.7+47] --log-dir /root/.CommandBox/server/serverHome/lucee-5.3.7.47/logs --server-name pollmodbus --tray-enable true --dock-enable true --directoryindex true --timeout 240 --proxy-peeraddress true --cookie-secure false --cookie-httponly false --tray-icon /root/.CommandBox/cfml/system/config/server-icons/trayicon-lucee.png --tray-config /root/.CommandBox/server/serverHome/lucee-5.3.7.47/.trayOptions.json --gzip-enable true --cfengine-name lucee -war /root/pollmodbus/ --web-xml-path /root/.CommandBox/server/serverHome/lucee-5.3.7.47/WEB-INF/web.xml --http-enable true --ssl-enable false --ajp-enable false --open-browser true --open-url http://0.0.0.0:80 --port 80 --urlrewrite-enable false --predicate-file /root/.CommandBox/server/serverHome/lucee-5.3.7.47/.predicateFile.txt",
        "COMMAND":"/usr/lib/jvm/java-11-openjdk-armhf/bin/java",
        "RESULT":"[INFO ] Runwar: Starting RunWAR 4.3.13\r\n[INFO ] Java version 11.0.9.1 (requires >= 1.8)\r\n[INFO ] Runwar: HTTP2 Enabled:false\r\n[INFO ] Runwar: HTTP sslEnable:false\r\n[INFO ] Runwar: HTTP ajpEnable:false\r\n[INFO ] Runwar: HTTP warFile exists:true\r\n[INFO ] Runwar: HTTP warFile isDirectory:true\r\n[INFO ] Runwar: Starting background pollmodbus [lucee 5.3.7+47] from: /root/.CommandBox/lib/runwar-4.3.13.jar \r\n[INFO ] Starting in background -\r\n"
    },
    "host":"0.0.0.0",
    "welcomeFiles":"",
    "rewritesConfigReloadSeconds":"",
    "name":"pollmodbus",
    "rewritesEnable":"false",
    "APPFILESYSTEMPATH":"/root/pollmodbus/",
    "blockCFAdmin":"false",
    "rulesFile":"",
    "verbose":false,
    "javaHome":"/usr/lib/jvm/java-11-openjdk-armhf/bin/java",
    "cfengine":"lucee@5.3.7+47",
    "console":"false",
    "allowedExt":"",
    "serverHomeDirectory":"/root/.CommandBox/server/serverHome/lucee-5.3.7.47",
    "HTTPEnable":"true",
    "serverConfigFile":"/root/pollmodbus/server-pollmodbus.json",
    "restMappings":"",
    "GZipEnable":"true",
    "RUNWARJARPATH":"/root/.CommandBox/lib/runwar-4.3.13.jar",
    "JVMargs":" ",
    "aliases":{},
    "engineName":"lucee",
    "heapSize":"",
    "trace":"false",
    "STARTTIMEOUT":"240",
    "GZipPredicate":"",
    "DEFAULTBASEURL":"http://0.0.0.0:80",
    "webConfigDir":"/WEB-INF/lucee-web",
    "maxRequests":"",
    "PORT":"80",
    "WARPath":"",
    "SSLKeyPass":"",
    "directoryBrowsing":true,
    "profile":"development"
}

server-pollmodbus.json

{
    "name":"pollmodbus",
    "profile":"development",
    "web":{
        "host":"0.0.0.0",
        "http":{
            "port":"80"
        }
    }
}

Hmm, that makes no sense. The stopsocket is clearly defined. Since I’ve never heard this reported by anyone else before, you’d need to debug it on your machine. I’d recommend adding some debugging code in the ServerService where that error is happening and debug just what exactly is in the serverinfo struct at the point of the error for clues.

function isServerRunning( required struct serverInfo ){
 		systemOutput( serverInfo, true )
 		var portToCheck = serverInfo.stopSocket;

Run the

reload

command and then re-create the error and you’ll get a dump of that struct in the console.

I just restarted my machine and then everything worked like it was supposed to.

1 Like