Service manager is not working. the -out log has t...
# box-products
d
Service manager is not working. the -out log has this:
Copy code
[38;5;9m[1mYou specified named parameters: serverConfigFile,directory,name but you did not specify a name for: 1 
	server start name='Staging 1 Api' directory='E:/sites/apistaging1/' serverConfigFile='E:/sites/apistaging1/server.json' --console --verbose --noSaveSettings --noOpenBrowser --noTrayEnable[0m
I can start the server without the service manager fine.
b
That's odd, I don't see anything wrong with that command
Can you show me the output of
Copy code
server service info --verbose
Also, did this just stop working or has this server never worked?
Do other servers work?
d
Copy code
Looking for server JSON file by convention: E:\sites\apistaging1\/server.json
webroot defaulted to location of server's JSON file: E:\sites\apistaging1\
Service name: staging1api

Service status: paused

Running Processes:
   13224 E:\CommandboxHome\cfml\modules\commandbox-service-manager@ortus\bin\ServiceTranslator.exe


Service Dump (debugging):

  install staging1api E:/Commandbox/box.exe
  set staging1api AppParameters "server start name='Staging 1 Api' directory='E:/sites/apistaging1/' serverConfigFile='E:/sites/apistaging1/server.json' --console --verbose --noSaveSettings --noOpenBrowser --noTrayEnable"
  set staging1api AppDirectory E:/Commandbox
  set staging1api AppExit Default Restart
  set staging1api AppEnvironmentExtra :box_config_nonInteractiveShell=true
  set staging1api AppRestartDelay 15000
  set staging1api AppStdout E:\logs\staging1api-out.txt
  set staging1api AppStderr E:\logs\staging1api-error.txt
  set staging1api AppStopMethodConsole 15000
  set staging1api DisplayName staging1api
  set staging1api ObjectName cf_services@pprod.psomas.corp "****"
  set staging1api Start SERVICE_AUTO_START
  set staging1api Type SERVICE_WIN32_OWN_PROCESS
b
I copied and pasted that same start command and it ran without any issues
I don't quite understand where that error is coming from
d
I have all servers on that VM off right now
b
Can you enable verbose errors and see if there is a stack trace?
Actually-- is there a tag stack even ?
d
in the out log file?
b
Wherever you're seeing the output you first showed
It doesn't seem you showed all of it-- just a few lines
d
that the the out.txt log file configure for the service manager. And no, that is all there is in that log file
b
Usually when a server fails to start like that, its the wrong java version or something causing a low level JVM error I fond that error message in the CommandBox source code, and it's the one that gets thrown when you have a mix of named and positional params, but that doesn't seem to be the case according to what I'm seeing
that is all there is in that log file
That literally shouldn't be possible. here is the code that throws that error:
Copy code
var detail = "You specified named parameters: #structKeyList(parameterInfo.namedParameters)# but you did not specify a name for: #parameterInfo.positionalParameters[1]# #chr(10)##chr(9)#" & line;
				throw( message='Please don''t mix named and positional parameters, it makes me dizzy.', detail=detail, type="commandException");
			}
I don't see the actual error message in your output-- just the detail
How would that even be possible?
d
the entire dump of that file:
Copy code
[38;5;15m[48;5;9mERROR (5.5.2+00578)[0m

[38;5;9m[1mPlease don't mix named and positional parameters, it makes me dizzy.[0m

[38;5;9m[1mYou specified named parameters: serverConfigFile,directory,name but you did not specify a name for: 1 
	server start name='Staging 1 Api' directory='E:/sites/apistaging1/' serverConfigFile='E:/sites/apistaging1/server.json' --console --verbose --noSaveSettings --noOpenBrowser --noTrayEnable[0m



[38;5;15m[48;5;9mERROR (5.5.2+00578)[0m

[38;5;9m[1mPlease don't mix named and positional parameters, it makes me dizzy.[0m

[38;5;9m[1mYou specified named parameters: serverConfigFile,directory,name but you did not specify a name for: 1 
	server start name='Staging 1 Api' directory='E:/sites/apistaging1/' serverConfigFile='E:/sites/apistaging1/server.json' --console --verbose --noSaveSettings --noOpenBrowser --noTrayEnable[0m



[38;5;15m[48;5;9mERROR (5.5.2+00578)[0m

[38;5;9m[1mPlease don't mix named and positional parameters, it makes me dizzy.[0m

[38;5;9m[1mYou specified named parameters: serverConfigFile,directory,name but you did not specify a name for: 1 
	server start name='Staging 1 Api' directory='E:/sites/apistaging1/' serverConfigFile='E:/sites/apistaging1/server.json' --console --verbose --noSaveSettings --noOpenBrowser --noTrayEnable[0m
b
Ahh, so there IS more šŸ˜‰
The error message appears in your second output above
I have no idea why you'd get that error
According to the message there is an additional positional param called "1" but I don't see that at all in your command
There is a 1 in the name, but it's contained within quotes
When I run that exact same command, it works fine
Do you have any modules installed or custom aliases that would affect command parsing
like command aliases
d
no aliases
Copy code
āÆ package list --system
Dependency Hierarchy for CommandBox System (1.0.0)
ā”œā”€ā”¬ commandbox-cfconfig (1.10.0)
│ └─┬ cfconfig-services (1.18.2)
│   ā”œā”€ā”€ lucee-password-util (1.0.3)
│   ā”œā”€ā”€ coldbox ()
│   ā”œā”€ā”€ testbox ()
│   ā”œā”€ā”¬ JSONPrettyPrint (1.4.1)
│   │ ā”œā”€ā”€ coldbox ()
│   │ └── testbox ()
│   ā”œā”€ā”¬ adobe-password-util (1.0.8)
│   │ └── propertyFile (1.3.2)
│   ā”œā”€ā”¬ semver (1.2.6)
│   │ └── testbox ()
│   └── propertyFile (1.3.2)
ā”œā”€ā”€ commandbox-service-manager@ortus (1.4.1)
ā”œā”€ā”¬ commandbox-dotenv (2.3.0)
│ └── propertyFile (1.3.2)
ā”œā”€ā”€ commandbox-hostupdater (1.9.2)
└── commandbox-bullet-train (1.4.1)
b
What happens if you run that exact same command manually?
d
ok i'll try
b
Copy code
server start name='Staging 1 Api' directory='E:/sites/apistaging1/' serverConfigFile='E:/sites/apistaging1/server.json' --console --verbose --noSaveSettings --noOpenBrowser --noTrayEnable
When I run that, I get no errors. it just starts a server
d
I get errors about the Log4j but that is it.
server starts up fine
b
This makes no sense then
There must be something else being passed to Commandbox to parse
d
[INFO ] 2022-07-28 13:23:44 coldbox.system.web.services.LoaderService +++ ColdBox is ready to serve requests
is literally the last line on startup
b
You could enable debug mode in the box binary to inspect the actual args being sent into the Java process
d
how do I startup box.exe with debug mode
?
b
You'd need to edit the windows service CFC in the service manager CFC and add
-clidebug
to the start of the app parameters (before server start) and then update the service and try to start it again
It will create a ton of additional debug output, but will include the raw arguments that the java process receives from the shell process that calls it
d
k
b
If those look fine, then the issue would have to be somewhere inside of CommandBox itself
Actually, I may have reproduced this in some manner
If I run
Copy code
box -clidebug version 'test 1 brad'
then I get this in the debug output
Copy code
cfml.cli.argument.array: ["version","'test","1","brad'"]
which means Windows is ignoring the single quotes
Changing to
Copy code
box -clidebug version "test 1 brad"
gives the expected result of
Copy code
cfml.cli.argument.array: ["version","test 1 brad"]
d
where in this line do I add -clidebug ?
runNative( 'install "#config.getServiceName()#" "#getBoxPath()#" "server start name=''#parser.escapeArg( config.getServerName() )#'' directory=''#parser.escapeArg( config.getWebroot() )#'' serverConfigFile=''#parser.escapeArg( config.getServerConfigFile() )#'' --console --verbose --noSaveSettings --noOpenBrowser --noTrayEnable"' );
b
You must be the first person who's ever had a server name with a space in it using the service manager, lol
d
lol
b
nevermind
I already found the issue
I didn't know WIndows didn't support single quotes-- it's always worked by accident I guess šŸ¤”
d
service name with a space? let me see. I'll change it if I have to
b
I used those because the actual command to specify the args used double quotes around it
Yeah, taking out the space will work
but I can also fix this in the service manager module by using double quotes if I can figure out how to freaking escape them, lol
d
Copy code
"service":{
        "startType":"auto",
        "username":"${cf_services_username}",
        "password":"${cf_services_password}",
        "serviceName":"${servicename}",
        "displayName":"${servicedescription}",
        "exitAction":"Restart",
        "restartDelayMS":"15000",
        "standardOutPath":"${site_logs_out_filepath:C:/Development/logs/api-out.txt}",
        "errorOutPath":"${site_logs_error_filepath:C:/Development/logs/api-error.txt}"
    }
and in my .env file
servicename=staging1api
there is no space
nor end of line space
b
We're not talking about the service name
It's server name
Look at the command!
Copy code
server start name='Staging 1 Api' ...
d
ah yes reread your comment.
b
ā˜ļø That's the name of the Commandbox server, not the Windows service
d
hey thank you for figuring this out for me.
b
Sorry for the delay, I went to go get a fix in the service manager and I've literally been screwing with my firewalls and 2FA this entire time trying to get my freaking SSH access to our private Gitlab server to work šŸ˜•
I'm staying in an Air BnB this week so my normal whitelisted IPs aren't working
d
its all good. That sounds like its a pain.
b
@Daniel Mejia Ok, that took about 100 times freaking longer than it should have (I hate how unproductive I am when I'm not on my usually setup)
Please update to the latest version of the service manager, create your service fresh with a space in the commandbox server name and see if it works now out of the box
When you run
Copy code
server service info --verbose
you should see the start server command with a bunch of ugly
^
escape chars in it