Skip to main content
Participant
June 12, 2023
Question

Application not starting the Server.cfc which has the onServerStart() method

  • June 12, 2023
  • 3 replies
  • 494 views

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.

    This topic has been closed for replies.

    3 replies

    BKBK
    Community Expert
    Community Expert
    July 14, 2024
    quote

    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.

     

    quote

    ... 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.

     

    Community Expert
    July 14, 2024

    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 

    Dave Watts, Eidolon LLC
    dejank52055655
    Inspiring
    July 14, 2024

    Hi, I'm guessing this is customtag. Did you ever find the solution?

    dejank52055655
    Inspiring
    July 14, 2024

    Dave and BKBK suggestions solutions worked for me.