Extending Application.cfc

Hi everyone!

I am changing all my mappings from being defined in the Lucee Admin, to a struct in Application.cfc
But have hit a problem;

My Application.cfc extends the MachII framework @ line 1
<cfcomponent extends="MachII.mach-ii" output="true">

However, the mapping to MachII doesn’t exist yet.
Do I need to put the MachII mapping back into the admin or is there another solution, that I am missing?

As always - thanks!

Add the mapping to your Application.cfc.

Take a look at the end of my last PR to the docs. It has been merged already, but the build still has to make it to the website. Meanwhile you can use this file copy. A template is at the end of the file.


Also, use the export function of the Lucee Admin to help you export that settings to the Application.cfc

You may need something like this set in your Application.cfc:

<cfset this.mappings["MachII"]={ physical:"c:\path-to-your-components-directory\" }/>

That won’t work, Andreas, because the MachII mapping is being referenced in the extends attribute before the application mappings are defined.

We generally set up a /library mapping in our server admin which is the only “pre-defined” mapping for the instance, and then put frameworks (in our case FW/1 and Taffy) in that location, so we can do extends="library.framework.one".

Another way round it would be to reference MachII using a relative path, i.e. place the MachII folder in the same location as your Application.cfc. Or you could have it in a different location, such as one level above, and use extends="../MachII/mach-ii".

(Btw, great work on the Application.cfc docs, Andreas :+1: )

1 Like

Thanks to you both (@Julian_Halliwell, @andreas) for the help;

I did some more googling found a really old Mach-II post about this issue…
Julian’s suggestion of putting it in the same directory as Application.cfc is the suggested way to fix this.

Thanks - Onwards and Upwards.

Thx for the good clarification @Julian_Halliwell Usually I test every solution I write down, but hadn’t the time lately. Therefore, I thank you very much for the correction.