Web contexts disappear after restart

I have a server where the Web contexts disappear in the Server Admin after restarting Lucee. I have two other identical configurations (same OS, same Version install of Lucee) but on this particular box once I reboot or restart Lucee the web context list is either blank or has one context listed. Making a request to each website context restores the context in the server admin. The only thing that changes is the URL column. All websites have started out as IP numbers but now the URL shows the domain name if visited that way or restores to the IP number if accessed in that manner. I don’t see this behaviour on the other installed servers but unlike the other servers this box will have many >20 web contexts. I am not sure where to begin to look.

Is the Server admin contexts list stored in an XML file somewhere or are they generated on the fly? Where should I be looking?

Any assistance is appreciated. Everything else seems to be working OK.

System Information

Version Lucee 5.3.6.61


Version Name Gelert
Release date May 18, 2020 Remote IP 192.168.0.105


Windows IIS 10
Servlet Container Apache Tomcat/9.0.35
Java 11.0.7 (AdoptOpenJDK) 64bit
Host Name 192.168.0.26
OS Windows Server 2016 (10.0) 64bit
Architecture 64bit

A day later and a little bit wiser. It appears as if this behavior, the web context list disappearing from the server admin after restart, is a normal function of how Tomcat and Mod_cfml works. Something I did not know.

While trying to learn how things work on a starship (sorry for the Trek reference) I found that the entire function of Mod_cfml is to dynamically create hosts on demand and that they are not committed to a server file. So when the Tomcat/Lucee server is restarted the host doesn’t exist in the server until a request is made from the host. So this means that after a restart the server admin will not see the dynamically created hosts until there is a request made to them.

I found this in the documentation in the Mod_cfml docs.

How can I remove or “re-install” a host that has been created wrong?

Accidents happen. Usually this just means that the host wasn’t configured in the web server correctly before the config was copied to Tomcat. To clear out a host created in Tomcat with mod_cfml, go to the Tomcat Host Manager and remove the host. Mod_cfml will then create a new host entry whenever another request for that domain comes in.

Alternatively, you can restart Tomcat to clear out all dynamically created hosts.

1 Like

If you want to load the contexts during Tomcat’s start up process rather than on-the-fly with mod_cfml, you can manually add them to Tomcat’s server.xml file. With a Lucee Installer based install, that file is commented so that you can copy and paste the example config at the bottom of the file and just change the domain name and file location.

Understand that you will need to manually edit your context again in Tomcat if it ever changes in your web server.

I am actually good with the contexts being created dynamically after startup. The reason I thought it was a problem was because I didn’t realize that was how Mod_CFML worked. Duh! I assumed, incorrectly, that it wrote the contexts to an XML file saving you the hassle or manual entry. But in retrospect, from an administration perspective, it makes sense that it holds them in memory. So if you delete a web context folder you can just restart Lucee/Tomcat to remove it from server admin without the need to edit the config.

Maybe this thread will illuminate someone else with that nugget of knowledge. Thanks for the reply.

Exactly. Glad you figured it out and thanks for sharing your thoughts in this post. =)