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

Posted February 19, 2012 at 1:05 PM by Ben Nadel

Tags: ColdFusion

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. So, first things first:


 
 
 

 
Adobe ColdFusion 10 public beta released - OH MY CHICKENS!  
 
 
 

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.


You Might Also Be Interested In:



Reader Comments

Feb 19, 2012 at 4:12 PM // reply »
70 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.)


Feb 19, 2012 at 6:58 PM // reply »
46 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?


Feb 19, 2012 at 10:18 PM // reply »
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.


Feb 20, 2012 at 8:22 AM // reply »
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.


Feb 20, 2012 at 8:26 AM // reply »
49 Comments

Whohas multiuserver running on Mac?


Feb 20, 2012 at 10:06 AM // reply »
11,238 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.


Dik
Feb 20, 2012 at 4:42 PM // reply »
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.


Feb 23, 2012 at 12:05 AM // reply »
270 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?


Dik
Feb 23, 2012 at 1:46 AM // reply »
2 Comments

@WebManWalking,

After installing Lion you can download it from the Apple support site: http://support.apple.com/kb/DL1421

Good luck!


Mar 1, 2012 at 8:06 PM // reply »
8 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.


Mar 2, 2012 at 12:53 PM // reply »
28 Comments

Cool. I am definitely going to have to try that on my MacBook Pro - its a similar setup to yours so thanks for the install tips.


May 16, 2012 at 9:56 AM // reply »
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.


Post A Comment

Comment Etiquette: Please do not post spam. Please keep the comments on-topic. Please do not post unrelated questions or large chunks of code. And, above all, please be nice to each other - we're trying to have a good conversation here.

Please review the following issues:

Author Name:


Author Email:

Author Website:

Comment:

Supported HTML tags for formatting: <strong>bold</strong>   <em>italic</em>   <code>code</code>







  • Help Wanted - Find Your Next ColdFusion Job
Ben Nadel's Company - Epicenter Consulting Recent Blog Comments
May 17, 2013 at 7:42 PM
HashKeyCopier - An AngularJS Utility Class For Merging Cached And Live Data
Ben - thanks so much for posting these Angular articles and findings, they've been a huge help towards learning one of the more 'complex' JavaScript frameworks out there (IMO). I have been using Angu ... read »
May 16, 2013 at 5:01 PM
UPDATE: Parsing CSV Data Files In ColdFusion With csvToArray()
Your code was the closest thing I've found to obtaining some direction for converting ISO fields to values that CF can translate properly. Thank you for posting! ... read »
May 15, 2013 at 10:37 PM
Very Simple Pusher And ColdFusion Powered Chat
hi id making plz easy ... read »
May 15, 2013 at 6:07 PM
Making SOAP Web Service Requests With ColdFusion And CFHTTP
Ben, you once again saved my bacon at work. Thank you, thank you, thank you! ... read »
May 15, 2013 at 4:15 PM
What If All User Interface (UI) Data Came In Reports?
@Josh, Thanks! @Ben, I definitely recommend the David West book "Object Thinking" I've been quoting from. It goes deeply into the philosophy and history of OO programming. His breadth ... read »
May 15, 2013 at 11:36 AM
Ask Ben: Print Part Of A Web Page With jQuery
I found this helpfull when you need to keep (refresh) the original parent page after closing the iframe child print dialog (Hoping you're not using a form at this time so it won't submit again): On ... read »
May 14, 2013 at 7:13 PM
What If All User Interface (UI) Data Came In Reports?
@Jonah, If there's any books you'd recommend on the subject of domain modelling, I'd love to hear it. I just downloaded the free PDF of "Domain Driven Design Quickly". Figured I'd give it ... read »
May 14, 2013 at 6:57 PM
The UX Of Prototyping: Low-Fidelity Is The New High-Fidelity
@Phillip, I'm not sure I follow what you mean? Are you saying that you looked at the list of widgets provided by the jQuery UI and let that be your style guide? ... read »
InVision App - Prototyping Made Beautiful With Prototyping Tools