but it seems to get ignored. I copied the string above directly from Lucee Admininistrator and then I deleted it from Lucee Administrator in order to set in Application.cfc. Any idea what Iâm doing wrong here?
No stack trace. The datasource is not there and any queries using that datasource I get datasource cannot be found. If I add in the Lucee Administrator, it works with no problem.
Lucee has a âfeatureâ where by it simply ignores any configuration errors in the Application.cfc. I would suggest putting in a ticket perhaps to improve the logging, but first do check all the server and web context logs just to make sure thereâs no errors logged to them.
Yes, all âthis.fooâ settings need to be in the pseudo constructor (outside of any method) but Iâm also highly confused as you seem to have a tag-based CFC with a bunch of script-based code slapped inside of a method which isnât going to work! Firstly, you need cfscript tags around any script code. And secondly, you donât need the component bits as youâre already inside of a component! I think youâre copying and pasting way too much from the examples.
@bdw429s I copied and pasted your code into an new Application.cfc and substituted the datasource connection parameters. Still not working:
Lucee 5.2.9.31 Error (database)
Message datasource [MyDSN] doesnât exist
Detail available datasource names are []
Datasource MyDSN
The datasource âMyDSNâ is referenced by some legacy code in the Application.cfm that I havenât converted to the Application.cfc yet however, everything works as expected ONLY if I manually add the datasource in Lucee Administrator.
Itâs possible Lucee is finding your Application.cfm first and ignoring the Application.cfc. If you put a dump/abort in the application.cfc, does it fire? Iâm not sure the order Lucee looks in, but Iâd recommend renaming or removing the Application.cfm.
So, I renamed Application.cfm and removed the include to it and it seems to be working in both the datasources and the component. Now, Iâm having a new issue. I have a global variable in the application named datasource that was set in the Application.cfm as:
<cfset datasource="MyDatasource">
So removing Application.cfm from the equation has broken this variable and my application is complaining that the variable doesnât exist.
So, I tried to set it as follows and itâs still not working:
component {
function onApplicationStart() {
application.datasource = "MyDatasource";
}
}
I tried setting it up as follows with no success either: