• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

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

New Here ,
Jun 12, 2023 Jun 12, 2023

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.

Views

129

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 14, 2024 Jul 14, 2024

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 14, 2024 Jul 14, 2024

Copy link to clipboard

Copied

LATEST

Dave and BKBK suggestions solutions worked for me.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 14, 2024 Jul 14, 2024

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 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 14, 2024 Jul 14, 2024

Copy link to clipboard

Copied

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.

BKBK_0-1720986524075.png

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation