I installed CFB2018 on my mac and trying to run my application.
In application.cfc i have a <cfinclude template="/adirectoryunderwwwroot/fileincluded.cfm"> and always i get a could not find the template error.
-The code directory is under wwwroot folder
-The path is mapped with a sym link.
-CFB2018 server is Coldfusion+Tomcat version and i changed the context.xml file to allow linking.
-CFB2018 server document root is under wwwroot folder
-When i try to navigate to the path using the browser I can reach that folder (so I think tomcat is correctly setup)
-I passed a chmod 777 on all files under the wwwroot
-I unchecked save class in the server admin console
-I tried with and without mapping in coldfusion and it doesn't change the behaviour.
Do you have any advice?
Copy link to clipboard
Your question and issue raise still more questions, in response:
Let's see if any of these get you down the road. There are many variables, and this one may be challenging to resolve easily by text this way.
Thank you Charlie,
here my answers:
1) The code is located under cfusion/wwwroot (/Applications/ColdFusionBuilder2018/ColdFusion/cfusion)
2) I'm trying to adapt the server enviroment (cf11/Suse) where the code is currently developed. There we have apache and cf11 and some folders are mapped with sym links. Sym link "il_shared" path is /Applications/ColdFusionBuilder2018/ColdFusion/cfusion/wwwroot/sharedcode/il_shared
3) Because I wasn't able to navigate from browser to the directory mapped, so (according to the tomcat documentation) I added in context.xml <Resources allowLinking="true"/>. After that I was able to navigate to the mapped folder
4) Yes I'm referring to the CF+tomcat bundle in cfbuilder to run my application and I'm able to navigate to the mapped folder (after enabling allowlinking).
The site I'm trying to launch is located in wwwroot/sites/site1 and the mapped folder is located in wwwroot/sharedcode/il_shared.
The cfbuilder server is started and running on port 8600 and the url I launch is: http://localhost:8600/sites/site1/default.cfm and as I said earlier I can navigate to http://localhost:8600/il_shared. The error I get is:
Could not find the included template /il_shared/global_application.cfm.
The error occurred in /Applications/ColdFusionBuilder2018/ColdFusion/cfusion/wwwroot/sites/site1/Application.cfc: line 26
26 : <cfinclude template="/il_shared/global_application.cfm">
5) I checked and I've no Coldfusion in opt folder, and to recheck I put a simple .cfm file in the folder I mentioned and, after commenting Application.cfc, It runs as expected.
Thanks in advance for your help.
Massimo, thanks for the clarifications. Lots to digest there, and to recommend.
First, now that we can see more clearly the include failure, your problem there is not with CF's built-in (Tomcat) web server and those context.xml changes you made. They affect BROWSING to that /il_shared. They do NOT affect CF doing a CFINCLUDE of it.
For CF to CFINCLUDE that folder, it either needs to be a real folder there or needs a CF Admin (or application) "mapping". Such a mapping tells CF (not the web server) where to map that sort of name (il_shared) when it is NOT a real folder. (I don't know if CF can't or won't read a symlink.)
The fastest solution would be to go into the CF Admin, to its Mappings page, and point il_shared to /Applications/ColdFusionBuilder2018/ColdFusion/cfusion/wwwroot/sharedcode/il_shared.
Another option would be to study how you can also add such mappings INSTEAD at the application level, with a this.mappings in your application.cfc. But you may not need to bother with that, since this is your own machine and likely the only app you need to worry about on it.
Again, the key here is understanding the difference in what you can see in browsing to that il_shared folder vs whether and how CF can CFINCLUDE it.
Finally, I'll note that you refer to how you're trying to "adapt" the setup from another environment which was running CF and Apache. But you are not using Apache on this machine, right? Just note that some of what you do and want to do will act quite differently because of that difference alone. You may want to implement Apache, even though it may seem a complication--at least if you want to have things more in sync with the other instance you're trying to model.
Back to the earlier discussion, I will say also that you may find value in a 2001 article I wrote (yes, hard to believe something from 2001 could still be relevant). I wrote it for the then Adobe Dev Center, which is gone, but I found the article on archive.org:
In it, I talk about the difference between various mappings (like CF admin and web server ones and still others). It was from the CF6 era, before application-level mappings were added (in CF7, I think). I also refer there to mappings in CF Studio, which was the precursor to CFBuilder. You may want to consider some of what I said, for the value it may have in mirroring some aspects of CFBuilder configuration, since you are talking about browsing from within that.
Let us know if this (especially my "fastest solution" above gets you going.