Adding second host in Tomcat

Hi guys,
I am trying to add second HOST under tomcat server.xml, but getting the following erros:

01-Sep-2023 09:47:12.469 SEVERE [main] org.apache.catalina.core.StandardContext.loadOnStartup Servlet [RESTServlet] in web application [] threw load() exception
        javax.servlet.ServletException: the web context [01b7860cceaf57b6652dc36e17e29042] has defined the same configuration directory [/srv/www/catalina-base/lucee-web] as the web context [4e9bf5f1d43c9c61c370ce45dd5f01b2]
                at lucee.runtime.config.XMLConfigWebFactory.newInstance(XMLConfigWebFactory.java:245)
                at lucee.runtime.engine.CFMLEngineImpl.loadJSPFactory(CFMLEngineImpl.java:940)
                at lucee.runtime.engine.CFMLEngineImpl.addServletConfig(CFMLEngineImpl.java:800)
                at lucee.loader.engine.CFMLEngineWrapper.addServletConfig(CFMLEngineWrapper.java:87)
                at lucee.loader.engine.CFMLEngineFactory.getInstance(CFMLEngineFactory.java:211)
                at lucee.loader.servlet.RestServlet.init(RestServlet.java:42)

and

01-Sep-2023 09:47:12.466 SEVERE [main] org.apache.catalina.core.StandardContext.loadOnStartup Servlet [CFMLServlet] in web application [] threw load() exception
        javax.servlet.ServletException: the web context [01b7860cceaf57b6652dc36e17e29042] has defined the same configuration directory [/srv/www/catalina-base/lucee-web] as the web context [4e9bf5f1d43c9c61c370ce45dd5f01b2]
                at lucee.runtime.config.XMLConfigWebFactory.newInstance(XMLConfigWebFactory.java:245)
                at lucee.runtime.engine.CFMLEngineImpl.loadJSPFactory(CFMLEngineImpl.java:940)
                at lucee.runtime.engine.CFMLEngineImpl.addServletConfig(CFMLEngineImpl.java:800)
                at lucee.loader.engine.CFMLEngineWrapper.addServletConfig(CFMLEngineWrapper.java:87)
                at lucee.loader.engine.CFMLEngineFactory.getInstance(CFMLEngineFactory.java:211)
                at lucee.loader.servlet.CFMLServlet.init(CFMLServlet.java:42)

I am using mod_cfml version: 1.1.11
My server.xml file is like:

    <Engine name="Catalina" defaultHost="localhost">

      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>

      <Host name="localhost"  appBase="webapps"
            unpackWARs="false" autoDeploy="false">

        <Context path="" docBase="${server.webroot}" mapperDirectoryRedirectEnabled="true" mapperContextRootRedirectEnabled="true"/>

        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log" suffix=".txt"
               pattern="%{yyyy-MM-dd'T'HH:mm:ssZ}t %s %a %r %{Referer}i &quot;%{User-Agent}i&quot; %I %T %{X-Original-URI}i %{cfid}c %{X-Request-ID}i"
               requestAttributesEnabled="true"
        />

		<Valve className="mod_cfml.core"
			loggingEnabled="false"
			maxContexts="999"
			timeBetweenContexts="0"
			scanClassPaths="false"
			sharedKey="My_secret_key"
		/>
      </Host>
      <Host name="test-mysite.com" appBase="webapps"
			unpackWARs="false" autoDeploy="true">
             <Context path="" docBase="/srv/www/app/webroot/mysite/src" />
              <Alias>test-mysite.com</Alias>
        </Host>
    </Engine>

The error is not showen when I have onl yone Host tag.
Do you have ideas how to resolve the errors?
I have tried with diferent versions of mod_cfml.core, different docBase and diferent appBase names.

This is my webContext:

Java Version: 11.0.20 (Red Hat, Inc.) 64bit
Tomcat Version: 9.0.80
Lucee Version: 5.4.3.2

the whole idea with mod_cfml is that it automatically creates hosts aka contexts on the fly?

under tomcat/conf/catalina are folders with a ROOT.xml?

i.e. C:\lucee6\tomcat\conf\Catalina\docs-localhost-httpd-confl667 has

<?xml version='1.0' encoding='utf-8'?>
<Context docBase="C:/work/lucee-docs/server">
  <WatchedResource>WEB-INF/web.xml</WatchedResource>
  <JarScanner scanClassPath="false" />
</Context>

which is generated automatically based on my apache http.conf entry


<VirtualHost *:81>
    ServerName  docs.localhost
    DocumentRoot  "C:/work/lucee-docs/server"
	ErrorLog "logs/docs-error.log"
	CustomLog "logs/docs-access.log" common
    DirectoryIndex index.cfm
    RewriteEngine on
    RewriteRule ^(.*)(/.*)?$ ajp://127.0.0.1:9009$1$2 [P]
</VirtualHost>

Thank you @Zackster for the quick reply, but my both folders are empty.

Maybe I am missing something during the configuration of mod_cfml?
I have tried without using mod_cfml, but the result was same.

If the config is missing from he server.xml the folder for my test-mysite.com is not created.

that’s with only one host entry?

With 2 host entries.

I manage to resolve the problem by updating the Tomcat web.xml file:
I added the configuration pointingto place where Lucee stores the web content:

  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!-- to specify the location of the Web Contexts' config and libraries,  -->
  <!-- uncomment the init-param below.  make sure that the param-value     -->
  <!-- points to a valid folder, and that the process that runs Lucee has  -->
  <!-- write permissions to that folder.  the {web-context-label} can be   -->
  <!-- set in Lucee Server Admin homepage.  leave commented for defaults.  -->
  <init-param>
    <param-name>lucee-web-directory</param-name>
    <param-value>/var/Lucee/config/web/{web-context-label}/</param-value> 
    <description>Lucee Web Directory (for Website-specific configurations, settings, and libraries)</description>
  </init-param>