chris-schmitz
06/01/2022, 6:17 AMinclude cfm
-> include cfm
-> include cfm
-> include cfm
-> call CFC method
-> new mapped.path.OtherCFC()
. In the last cfm I can dump this.mappings
and everything is there, but in the CFC method none of those are available. I tried GetPageContext().getConfig().getApplicationMappings()
to see which mappings are available, but apparently that does not list app specific mappings.
Does anybody have an idea how I could go about finding out why the mappings are "missing" or how to fix that?Gareth
06/01/2022, 6:29 AMchris-schmitz
06/01/2022, 6:33 AMgavinbaumanis
06/01/2022, 8:34 AMalexpixl8
06/01/2022, 8:38 AMalexpixl8
06/01/2022, 8:38 AMgavinbaumanis
06/01/2022, 8:39 AMalexpixl8
06/01/2022, 8:39 AMgavinbaumanis
06/01/2022, 8:40 AMbhartsfield
06/01/2022, 10:40 AMchris-schmitz
06/01/2022, 12:22 PMchris-schmitz
06/01/2022, 12:24 PMnew mapped.path.myCFC()
chris-schmitz
06/01/2022, 12:24 PMAdam Cameron
alexpixl8
06/01/2022, 12:47 PMalexpixl8
06/01/2022, 12:48 PMalexpixl8
06/01/2022, 12:49 PMAdam Cameron
import
statements when using the unqualified class reference in an extends
. But Lucee handles this fine.
I cannot reproduce any issue with extends / new / import / fully-qualified / un-qualified names and runtime Application.cfc-defined mappings on Lucee.
Which, to be honest, rather surprises me.Adam Cameron
chris-schmitz
06/01/2022, 4:05 PMmodul
(without an 'e', they use the German name here). If I do fileExists( expandPath( 'modul/path/to/any.cfc' ) )
in a CFC method, the file is found, so the mapping is working. If I do new <http://modul.path.to|modul.path.to>.any()
right in the next line, it says the component can't be found. And the result is the same if I use the old fashioned createObject()
instead.
I then tried the appoach @cfsimplicity mentioned in https://blog.simplicityweb.co.uk/123/forcing-lucee-to-re-check-the-physical-paths-of-application-defined-mappings-without-a-restart ... and did a loop over GetPageContext().getConfig().getApplicationMappings()
and displayed getPhysical()
for every mapping ... and I found mappings of a different application (different application name). πAdam Cameron
and I found mappings of a different applicationThat sounds like a smoking gun.
Adam Cameron
chris-schmitz
06/01/2022, 5:08 PMAdam Cameron
bdw429s
06/01/2022, 5:30 PMgetApplicationMetadata().mappings
. That is the documented way to get that databdw429s
06/01/2022, 5:30 PMgetApplicationMetadata()
and it will have the application name and everythingbdw429s
06/01/2022, 5:31 PMchris-schmitz
06/01/2022, 5:31 PMbdw429s
06/01/2022, 5:32 PMnew myModule.models.foo()
and I've never had an issue with it.bdw429s
06/01/2022, 5:33 PMchris-schmitz
06/01/2022, 5:36 PMgetApplicationMetadata()
couple of values seem right, but some seem wrong, e.g. the mapping struct is emptychris-schmitz
06/01/2022, 5:37 PMbdw429s
06/01/2022, 5:44 PMAdam Cameron
/modul
mapping, there's also a dir at /modul
in the file system, or in the web root (or application root? Can't remember) and Lucee is deciding that's what you mean instead of your same-named mapping?bdw429s
06/01/2022, 5:51 PM/foo
and see if it changes the behaviorbdw429s
06/01/2022, 5:52 PMbdw429s
06/01/2022, 5:52 PM/opt
and the actual *nix file system as /opt
as wellAdam Cameron
Adam Cameron
chris-schmitz
06/01/2022, 5:54 PMAdam Cameron
chris-schmitz
06/11/2022, 9:31 AMchris-schmitz
06/11/2022, 9:33 AMchris-schmitz
06/11/2022, 9:36 AMonRequestStar()
or onRequest()
2. Anywhere in the life cycle before defining the mappings, use expandPath()
with an argument that starts with a "/"chris-schmitz
06/11/2022, 9:40 AMAdam Cameron
onRequest
even works. I dunno why, but I would kinda expect all that sorta stuff to need to be set before the CFML engine starts to service the request. I have no basis for this thinking, but the practice seems... odd to me.
Still: if it works at all, it should work uniformly, and should not be able to be thwarted by other CFML code.
I note that neither CF nor Lucee actually document where in Application.cfc this.mappings
ought to be set, both just say "in Application.cfc"chris-schmitz
06/11/2022, 10:06 AMzackster
06/11/2022, 10:08 AMzackster
06/11/2022, 10:09 AMchris-schmitz
06/11/2022, 10:28 AMAdam Cameron
Adam Cameron
Adam Cameron
Adam Cameron
expandPath
call kicks of some broader process that resolves all existing mappings (I guess it has to, given that dir doesn't exist, so Lucee needs to try to work out WTF yer on about), but thereafter that's it... no more checks.Adam Cameron
Adam Cameron
expandPath
call refers to an existant (file system) pathchris-schmitz
06/13/2022, 1:04 PM