Cannot use parent Application.cfc using RootProxy

I have a legacy application that consists of multiple individual applications. There’s a root folder and each application resides in its individual subfolder. To share functionality each application inherits from a central Application.cfc after a pattern introduced by Ben Nadel.
To use this site under Lucee I use commandbox. I call start and navigate to the subfolder.
I get error: Component [site1.Application] has no accessible Member with name [WEBROOT]

This code, however, works in ACF. I have no Lucee server running so I cannot say if it’s an issue with Lucce or with the way Commandbox handles Lucee.

I put the relevant files in a Gist

Does Lucee handle includes differently than ACF and does therefore not accept a parent setup like I described?

If there’s no dependencies inside the root Application.cfc outside of what you’ve outlined, then these two are equivalent:

Application.cfc

<cfset this.webroot = GetDirectoryFromPath(GetCurrentTemplatePath())>

site1\Application.cfc

<cfset this.webroot = this.webroot & "/site1">

In other words, you could just use GetDirectoryFromPath(GetCurrentTemplatePath()) in site1\Application.cfc instead of including the root Application.cfc and then using this.webroot & "/site1".

Beyond that, however, the more common approach is to use the same this.name in all of your Application.cfc’s which allows sub-folders of the root to inherit the properties defined in the root Application.cfc. So, if you have additional dependencies beyond this.webroot then that’s probably a better approach. And, in which case, this.webroot = GetDirectoryFromPath(GetCurrentTemplatePath()) in each Application.cfc would be used.

EDIT: Quick caveat now that I think of it… you say you’re browsing to the subfolder so the above this.name approach should work (assuming you have dependencies outside of the this.webroot that aren’t already resolved by my first suggestion).

If, however, you were to have a domain/site/vhost pointed to that subfolder then the webroot would be that subfolder and the parent (root) Application.cfc would not be invoked. Just something to keep in mind with the this.name approach - it requires the root Application.cfc to always be webroot.

HTH

– Denny

Hi Denny,

thanks for your reply.
My issue is not about the content of the variable. The thing is in ACF I can access a variable from the this scope. It must have been created through the extends attribute and the cfinclude. In Lucee I cannot append to a this scope variable.

This thread is old, but I was curious if you were ever able to solve your problem with the application root proxy? I’ve got a legacy ACF app that I’d like to port over to Lucee.

The legacy app uses the root proxy strategy discussed here:

However, Lucee does not seem to include the “this” scope in the same way that ACF does. If you ever discovered a workaround, could you please share?

Thank you!