On Tuesday, Oct 29, 2002, at 18:05 US/Pacific, Brian Simmons wrote:
> In the C:\CFusionMX\wwwroot directory I have:
> test.cfm -> simply has <CF_MYTAG> call in it.
> mytag.cfm -> has the text: current directory
>
> In the C:\CFusionMX\CustomTags directory I have:
> mytag.cfm -> has the text: CustomTags directory
>
> I added the following directory as a Custom Tags Path in the CFMX
> Admin:
> C:\CFusionMX\MyCustomTags
> in that folder:
> mytag.cfm -> has the text: MyCustomTags directory
>
> I then run the page test.cfm and it works fine the first time. I then
> rename the C:\CFusionMX\wwwroot\mytag.cfm to mytag2.cfm.
>
> That's when all hell breaks loose. Strange errors occur (Index out of
> range
> errors, and all sorts of Java class errors show. Very unpredictable).
> Rebooted, all then seemed normal.
>
> Are these pages cached or something? Anyone have any ideas of what's
> going
> on?
There's a combination of things at play in this scenario...
First off, as far as I can tell, when you add custom tag path settings
in the admin, it scans and caches the directory structure - presumably
so that when a custom tag call is made, it can walk an in-memory list
of directories looking for the tag rather have to walk the physical
directory structure. I base this assumption on the observation that if
you've been running for a while and then manually add a new sub-folder
under one of the custom tag paths already specified, CFMX doesn't
notice it (until you change the CT paths or restart the service). So,
yes, it caches the directory structure.
Second, CFMX compiles .cfm / .cfc files on first use to .class files.
The .class files are effectively cached versions of the CF code and, as
several people have observed, if you delete the source file, CF
sometimes still serves up the .class file.
I think a combination of these two things causes the behavior you see.
CF has 'remembered' the directories to search for custom tags, it has
compiled test.cfm calling mytag.cfm in wwwroot and then you 'deleted' a
source file. The next run would try to establish whether recompilation
was necessary but the mytag .class file no longer has a source file so
at that point, it probably can't figure out what to look for...
I guess this is a bug but I'd hazard a guess that solving it would
decrease performance. The workaround ought to be to delete the
appropriate .class files (from WEB-INF/cfclasses).
> Anyone know exactly how the Custom Tags Path (new in the CFMX Admin)
> are
> supposed to work (specifically their search order)?
> Used to be:
> Calling directory first, then C:\CFusion\CustomTags directory
> But then CFMX adds this ability for additional CustomTags directories.
As far as I can tell, it's:
- calling directory
- custom tag paths, in order (I assume)
CFMX also adds the ability to specifically import a custom tag
directory as a prefixed tag:
<cfimport taglib="/my/tag/dir/" prefix="my"/>
<my:simpleTag/>
Which causes /my/tag/dir/simpleTag.cfm to be called as a custom tag.
Sean A Corfield -- http://www.corfield.org/blog/
"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for
dependable ColdFusion Hosting.