Category Archives: Railo

Railo after Upgrading to OSX Mavericks

Recently I upgraded my MacBook pro to OSX Mavericks (10.9). Almost everything worked nicely until I tried to open a development page I serve using Tomcat-Railo (3.3.1 I think) and I got nothing…

So without further preamble I am going to chronicle my problems and their solutions in a few short steps to get you going with Railo on OSX Mavericks. NOTE: these instructions are if you use the OS’s inbuilt JVM, if you use a bundled JVM you probably only need to follow Step 1 and 3.

The default place of {Railo Home} is /Library/Railo/.

Step 1


No seriously – it’s not all that bad, you don’t need to upgrade/reinstall anything. Then Shutdown Railo using {Railo Home}/connector/, just to be safe (it probably isn’t running anyway).

Step 2

Install Java – any variant should do (or did for me). The issue here is that Mavericks uninstalls all your previous versions of Java quite happily and without letting you know. I installed the latest jdk which was Java Platform (JDK) 7u45.

This should then install to /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/

Step 3

Fix apache – see this blog post here:

Step 4

Change/Add the script to tell railo/tomcat where java is. You find this file at {Railo Installation}/tomcat/bin/. Mine reads as follows:

<br />JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home<br />PATH=$PATH:$JAVA_HOME/bin<br />CLASSPATH=$CLASSPATH:$JAVA_HOME/lib<br />

Step 5

Start Railo using {Railo Home}/connector/

Your sites should be working again!

Contestate Site

A while back I had launched a site called that I wrote myself with the help of a themeforest template. The site is built with the idea of a mobile/desktop app to track competitions between friends. A few of the things that I have posted in the angularjs and coldfusion sections of this blog originated in problems I had in building the site. I had previously only really opened it up to a few friends, but now I am opening it up to the world at large – it’s free (my company kindly gave me free hosting, So go check it out: (and don’t worry about the Open Alpha tag I have on there, the security is the same I use for my live apps and we have ironed most of the bugs out.) I would appreciate any criticisms/bugs/suggestions or anything on the system, just leave them here in the comments, on the Contestate page up top or email them through to the contestate email address.


EDIT This has been taken offline as the hosting has been discontinued and I don’t feel the need to continue paying for hosting for something that isn’t used!

CFWheels, OSX Lion Apache, Tomcat and Railo

Recently I got a new Macbook pro, hence this post as it took me a while to get a reliable way of getting the connectors and CFWheels URL rewriting in partial,off and on modes (Different sites to differing requirements).

Now there are a few other blog’s I’ll start off giving credit to for their solutions as follows:, getrailo installation wiki and a few others I cannot remember at the moment.

For my install I followed the get railo instructions down till “Connect Tomcat To Apache” which I could not for the life of me get to work. Then I mucked around with the many other resources you will find by doing a quick google then using the information from the railodeveloper link I came up with the following solution.

Connecting Tomcat To Railo.

An exact lift from the link under the title of “Use mod_proxy if you have Apache 2.2 or later” (I discovered OSX lion has Apache 2.2.4). Note that you do this EXACTLY, including especially the localhost:8009 – this is the port that the ajp connector runs on, it’s where Tomcat and apache talk AFAIK.

Now you should have normal coldfusion functions working handily! (Multiple hosts as set up by method 2 here:

Activating CFWheels URL Rewriting For individual sites.

Here’s the code for my “contestate” site that has full URL rewriting on it, but also allows for partial URL rewriting:

<VirtualHost *:80>
 ServerName contestate
 ServerAlias contestate.x-wing
 Options +FollowSymLinks
 ProxyPreserveHost On
 ProxyPassReverse / ajp://localhost:8009/
 RewriteEngine On
 RewriteCond %{REQUEST_URI} !^.*/(flex2gateway|jrunscripts|cfide|cfformgateway|cffileservlet|railo-context|files|images|javascripts|miscellaneous|stylesheets|robots.txt|favicon.ico|sitemap.xml|rewrite.cfm|index.cfm)($|/.*$) [NC]
 RewriteRule ^(.*)$ ajp://localhost:8009/rewrite.cfm/$1 [NE,P]
 RewriteRule ^(.*)$ ajp://localhost:8009/$1 [P]

Lastly you have to add a mapping in the tomcat web.xml file for the index.cfm/ redirects as follows:


That’s all, any questions post in the comments, or if you found a better way I’d be happy to know!

CFDocument Formatting Quick Tip

So recently I have been messing around a bit more with the CFDocument tag and keeping sections together. As noted elsewhere on the internet there is no simple way of fixing this until I quite happily stumbled on a solution (in railo at least). Basically if a table is less than the total height of a page it will be kept together! Now all those people who tell you tables are evil and should not be used may jump in horror at what I suggest you do next, which is that you code your CFDocuments as follows:

<table><tr><td> ...Some HTML/CF output code that you don't want a page break in... </tr></td></table>

Now It is neither elegant or nice to code, but for some reason it seems to work. Hope this helps someone else!

Coldfusion upload and rename a file.

Shock; my second post in a week (most likely NOT a regular occurrence). Today I solved a problem that, to me, seems difficult to find a solution online. This is the issue (this may only be specific to railo now) that if you perform the following code, (assuming a file submitted from a form) the file is uploaded but errors with “cannot move file” on the rename. I use it slightly modified to keep versions of files.

<cffile action="upload" fileField="file" destination="#ExpandPath("./")#" nameConflict="makeUnique" result="upload">
<cffile action="rename" source="#ExpandPath("./")#" destination="#ExpandPath("/document_#otherversions + 1#.#upload.serverFileExt#")#">

My solution is simple, I use the java File object to rename it, apparently this fixes the issue. As follows:

<cffile action="upload" fileField="file" destination="#ExpandPath("./")#" nameConflict="makeUnique" result="upload">
<cfdirectory directory="#ExpandPath(filedirectory)#" action="list" filter="documents_*" name="historic" sort="desc">
<cfset javaFile = CreateObject("java", "").init(ExpandPath("./" & upload.serverfile))>
<cfset renamePass = javaFile.renameTo(CreateObject("java", "").init(ExpandPath("/document_#otherversions + 1#.#upload.serverFileExt#")))>