Skip to main content
Ben Nadel at the jQuery Conference 2010 (Boston, MA) with: The jQuery Community
Ben Nadel at the jQuery Conference 2010 (Boston, MA) with: The jQuery Community

ColdFusion 10 Beta, Apache Tomcat, And Symbolic Links On Mac OSX

By
Published in Comments (12)

As you have probably heard, Adobe has released a public beta of ColdFusion 10 - code name Zeus. After many many months of meetings, gathering feedback from clients and developers, dropping hints, and demoing new features, the wonderful engineering team has finally unleashed ColdFusion 10 on the general public.

Now that I've got that out of my system, I wanted to quickly talk about setting up ColdFusion 10 on my MacBook Pro. As a ColdFusion developer and blogger, I have a "testing" folder on my local machine in which I do pretty much all of my research and development. I installed ColdFusion 10 beta as a standalone server; but, I didn't necessarily want to start coding in the ColdFusion 10 beta webroot. Really, what I'd like is to keep all of my files in my standard "testing" directory, but run them through Apache Tomcat.

I know that the Mac OSX operating system can create links and aliases. I don't know much about them; but, it seemed like this might be exactly what I needed. So, I went into the "wwwroot" folder of my ColdFusion 10 beta standalone server:

/Applications/ColdFusion10/cfusion/wwwroot

... and I created a symbol link to a "coldfusion10" subdirectory that I created in my main "testing" directory:

ln -s /Sites/bennadel.com/testing/coldfusion10/ coldfusion10

This created a new directory in my ColdFusion 10 beta webroot that actually pointed to my testing directory:

ben-2:wwwroot ben$ pwd
/Applications/ColdFusion10/cfusion/wwwroot

ben-2:wwwroot ben$ ls -l
total 16
CFIDE
WEB-INF
cfdocs
coldfusion10 -> /Sites/bennadel.com/testing/coldfusion10/
crossdomain.xml

This looked awesome! However, when I went to access this webroot in my browser - http://http://127.0.0.1:8500 - there was no "coldfusion10" item listed in the directory contents.

After some Googling, this turned out to be a security measure on behalf of Apache Tomcat - the new servlet container that's replacing JRUN. I don't pretend to understand how J2EE servers or servlet containers work; but, according to the documentation, I had to explicitly enable symbolic links in the Tomcat context.

In order to do this, I had to edit the server configuration file:

/Applications/ColdFusion10/cfusion/runtime/conf/server.xml

Within this file, I had to uncomment the Context XML node and add the "allowLinking" attribute:

<Context
path="/"
docBase="/Applications/ColdFusion10/cfusion/wwwroot"
allowLinking="true"
WorkDir="/Applications/ColdFusion10/cfusion/runtime/conf/Catalina/localhost/tmp">
</Context>

When I uncommented this XML element, I had to replace the value "<cf_home>" with the path to my cfusion folder, "/Applications/ColdFusion10/cfusion". Notice that this Context element has (allowLinking="true") - this is what tells Tomcat that it is OK (from a security standpoint) to follow symbolic links in the web directory.

After I updated the server.xml file, I had to restart the ColdFusion 10 service. To do this, I executed the "coldfusion" command in my Mac OSX terminal:

/Applications/ColdFusion10/cfusion/bin/coldfusion stop
/Applications/ColdFusion10/cfusion/bin/coldfusion start

Once I did this, my "coldfusion10" directory started showing up in my ColdFusion 10 beta standalone webroot. Now, I can keep all of my ColdFusion 10 research and development (R&D) code in my standard R&D folder. Pretty sweeeet!

As a side note, ColdFusion feels pretty snappy running on Apache Tomcat. Granted, the pages that I am running are local and have a tiny amount of code on them; but, the pages just feel like they load instantaneously. It might be all in my mind, but Tomcat feels like it will bring some decent performance improvements.

Reader Comments

81 Comments

Thanks, Ben.

Is your MacBook Pro running Lion or Snow Leopard?

(My ONLY reason for not upgrading my MBP to Lion was that it wouldn't support CF 9. No PowerPC apps on the laptop to get messed up by the loss of Rosetta. I'm still on Snow Leopard for that sole reason.)

52 Comments

I'm running CF9 on Lion just fine, but it survived the upgrade from 10.6 to 10.7. Perhaps it's just the installer that's Rosetta reliant?

17 Comments

Ben, do you plan to do some performance comparison of scripts running on CF9 and CF10? I am (.. we all yeah!) very interested in what Tomcat brings us. A long awaited upgrade for our lovely CF.

16 Comments

On former JRun based installations of ColdFusion (on any OS) I frequently took adavantage of JRun Virtual Directories by adding new virtual contexts to the WEB-INF's jrun-web.xml. Tomcat does not have an equivalent. Now I have to use symbolic links to replace my use of JRun Virtual Dirs. Of course I always knew you can create symlinks on *nix based platforms, but thanks to Sam Farmer I know now that you can create symlinks on Windows too, so this is a perfect substitute for virtual dirs now.

15,848 Comments

@WebManWalking,

I can't remember the name of the version I have :) It's 10.6.8. I think it's Snow Leopard?

@Kirill,

I would be happy to run any tests; however, I don't really know what specific features would necessarily be tied to the servelet container when it comes to performance? Meaning, I wouldn't know what to test, really.

I can say that these pages are reporting ~2ms in the debugging and that all previous versions of ColdFusion never dropped below 16ms for me. Of course, I don't know if that means its running faster; or, if the timer is just more accurate.

@Steven,

This is my first time crating a Symbolic Link. They seem pretty cool! Though, they can make my file system a bit confusing :)

@John,

I *believe* I have version 8 + 9 running in multi-instance deployment mode. Jamie Krug helped me set it up a while back. Each version is deployed locally as a "car" file?? I don't really have a good grasp of things at that level, so forgive me if I am way off base.

2 Comments

@WebManWalking,

I have CF9 running on OS X Lion without any problems. I did both an upgrade from Snow Leopard to Lion (with CF 9 already installed) as a clean install of Lion (and of course a clean install of CF 9).
Only the Java Runtime have to be installed manually prior to installing CF, since it's not included in the Lion installation.

290 Comments

@Dik,

Thanks. I've had the Lion installer for a while now. Your post has inspired me to go ahead and do it. But first...

How did you install the Java Runtime if it's not included in the Lion installation? Where'd you get it from?

11 Comments

When I worked at a large telecom we lived on symlinks. The document root the webservers saw was a symlink the current codeline. To deploy a new release just point the link to the new code line. To back out just repoint the link to the old code line. Worked like a charm.

In my current work I often have to work in two different branches of code. I just have a little bash script that creates the appropriate symlinks for each branch so switching branches is simple - run the appropriate script and restart CF and Apache.

6 Comments

Hi,

Now that ColdFusion 10 is out I have stumbled over this as well and I cannot figure out the proper solution.

We're running virtual hosts via Apache2; the ColdFusion-applications store their files somewhere below the /var/www-hierarchy. We're using symlinks inside this hierarchy for shared scripts. None if this is anywhere below /opt/coldfusion10/cfusion/wwwroot.

When I do as Ben suggested and uncomment the first Context-node, ajust the paths to point to ColdFusion's wwwroot and add alloLinking="true", I still get path/file not found errors for cftemplate and cfajaxproxy for symlinked code that resides in the virtual hosts's directories below /var/www.

Now: What type of context configuration would I need to add to server.xml to enable symlinks below /var/www (or better: anywhere)? Are symlinks a no-go for ColdFusion 10?

It'd really be a nuisance to have to set up bind-mounts on all servers instead of a simple symbolic link on our NAS, so this is something of a nuisance for us with ColdFusion 10.

I believe in love. I believe in compassion. I believe in human rights. I believe that we can afford to give more of these gifts to the world around us because it costs us nothing to be decent and kind and understanding. And, I want you to know that when you land on this site, you are accepted for who you are, no matter how you identify, what truths you live, or whatever kind of goofy shit makes you feel alive! Rock on with your bad self!
Ben Nadel