Copy link to clipboard
Copied
Hi,
I am running my coldfusion application via docker, the application has a onServerStart() method in a file called Server.cfc which lies inside the webroot of our coldfusion project, when building the container the Server.cfc does not get triggered, although I can do it from the admin console(that works) but is there any other way to do the same.
I have also tried to create an object of Server.cfc and calling from the application.cfc, but using that the control goes into the server.cfc method but does not initialize the server with the details.
Thanks in advance.
Copy link to clipboard
Copied
Hi, I'm guessing this is customtag. Did you ever find the solution?
Copy link to clipboard
Copied
Dave and BKBK suggestions solutions worked for me.
Copy link to clipboard
Copied
Did you check your server.cfc location in CF Administrator?
https://helpx.adobe.com/coldfusion/cfml-reference/application-cfc-reference/onserverstart.html
Dave Watts, Eidolon LLC
Copy link to clipboard
Copied
Hi,
I have also tried to create an object of Server.cfc and calling from the application.cfc
By @anirbang43046357
You should not be doing that, as it goes against the reason why Server.cfc exists. OnServerStart is an event-handler. It fires automatically, if enabled. ColdFusion is the one that internally instantiates the Server object, not you, the developer.
Expecting the Application to start the Server is analogous to expecting the tail to wag the dog.
... when building the container the Server.cfc does not get triggered, although I can do it from the admin console(that works) but is there any other way to do the same.
The usual way to trigger onServerStart is indeed through the ColdFusion Administrator, as Dave has said. I saw his post only after I posted. So I had to modify my post to avoid repeating his suggestions.
Follow the instructions he has provided, and things should work out.