I recently, finally, got Lucee working on my local mac for development purposes. It’s working, more or less, perfectly, but I think I have done something wrong. As the title indicates, I have a LOT of contexts for 12 sites. I have put the contexts in their own folder so they aren’t ‘in the way’, but as I was testing a remotely called component in a subfolder earlier today, it wouldn’t trigger the datasource set in application.cfc. I tried a bunch of different ways of setting the datasource (normal has just been ‘this.datasource = xxx’), both in application.cfc and then also by calling it specifically in the query. It seems like that component is not reading the right application.cfc, which I think is probably down to it having it’s own context, and thus expecting an application.cfc?
So site layout is as follows:
/application.cfc
/callingpage.cfm → queries here see the datasource.
/components/remote.cfc → a query on this page can’t see the datasource.
I also tested a page /components/index.cfm with a single query on it and I get the same error:
“attribute [datasource] is required when attribute [dbtype] is not [query] and no default datasource is defined”
If I look at the lucee server config, I have a list with literally (I guess) 157 different web contexts. Basically any sub folder to the main root folder for each site has a context. It doesn’t appear to go 2-deep.
What have I done wrong here? I assume I should just have the one context for the main root for each site (and then I hope each folder will find the correct application.cfc from there)? That’s in any case how it looks on my production server.
It’s set up with apache 2.4 / tomcat 9.0.3.7 and the lucee war file. I have this under web.xml, and the only reason for the non-default web-directory is all the web-inf files drove me crazy (I don’t mind one on the main folder obviously).
<servlet>
<servlet-name>CFMLServlet</servlet-name>
<description>CFML runtime Engine</description>
<servlet-class>lucee.loader.servlet.CFMLServlet</servlet-class>
<init-param>
<param-name>lucee-server-directory</param-name>
<param-value>/Library/Tomcat/lucee</param-value>
<description>Lucee Server configuration directory (for Server-wide configurations, settings, and libraries)</description>
</init-param>
<init-param>
<param-name>lucee-web-directory</param-name>
<param-value>/Library/Tomcat/lucee/contexts/{web-context-label}</param-value>
<description>Lucee Web Directory (for Website-specific configurations, settings, and libraries)</description>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
Under server.xml a site mazzy.local has this:
<Host name="mazzy.local" appBase="/Users/XXX/Sites/mazzy">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="mazzy_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" />
</Host>
And under conf > Catalina > mazzy.local there is a ROOT.xml with JUST the following:
<?xml version='1.0' encoding='utf-8'?>Not using mod_cfml at the moment. Just manually added the sites in virtual hosts and tomcat.
Thoughts?
Don’t forget to tell us about your stack!
OS: Mac 10.15.6
Java Version: openjdk version “11.0.8” 2020-07-14
Tomcat Version: 9.0.3.7
Lucee Version: Lucee 5.3.6.61