Aliaspooryorik
ColdFusion ORM Book

Running the same Code on ColdFusion & Railo

I've been working on some code which needs to be able to run on ColdFusion and Railo. There are several posts about running them on top of a servlet container or JEE server, but I've gone for a quick and dirty solution which I use on Windows.

I have ColdFusion installed as standalone connected to an Apache webserver (it could be IIS it makes no difference). I have also downloaded and extracted the Railo Express version which runs on Jetty to c:\webserver\railo-express (where you extract it is not important as long but avoid spaces).

You can fire up Railo by finding the start.bat file in the C:\webserver\railo-express directory. After a couple of seconds you'll be able to browse to http://localhost:8888 and see the Railo welcome screen. As Railo is running on port 8888.

If port 8888 is already in use (or you want to run on port 80) you can choose a different port by editing the following line in the jetty.xml configuration file.


<Set name="port"><Property name="jetty.port" default="8888"/></Set>

If you do choose port 80, make sure that IIS and the Apache webserver are not running.

Railo will run code in the C:\webserver\railo-express\webroot\ directory. Obviously i only want one version of my code so copying code from the ColdFusion webroot to the Railo webroot is not an option.

Thanks to Gert from Railo for pointing out in the comments that you can just edit the Railo.xml file to point to your existing webroot by editing the line:


<Set name="resourceBase"><SystemProperty name="jetty.home" default="."/>/C:/webserver/htdocs/</Set>

Or, instead, I can create a "virtual folder" in the Railo webroot which links to the ColdFusion webroot. This is called a Symbolic Link and you can do it in Windows 7 by firing up a DOS prompt (type cmd into the "search box" on the Windows 7 start menu or use the "run" dialog).

Change the current working directory to the Railo webroot by typing in:


cd C:\webserver\railo-express\webroot\

Now create the symbolic link to the directory where you have your ColdFusion webroot.


mklink wwwroot C:\webserver\htdocs /D

If you run that command you should see:


symbolic link created for wwwroot <<==>> C:\webserver\htdocs

Now you can run the code in the ColdFusion webroot via Railo Express by doing:


http://localhost:8888/wwwroot/myscript.cfm

If ColdFusion is running at the same time then you can run the same script at the same time in two different CFML engines. This isn't a perfect solution (see Matt Woodwood's post on how to do it better) but it's quick and easy :)


2 comments

  1. Actually you could have Railo run in the same directory by changing the context/railo.xml file and configure it to use the directory C:\webserver\htdocs as its web root. In addition you only need to move the WEB-INF directory out of the corresponding webroot. There is a blog entry about this, and then it works without symlinks...

    blog.getrailo.com/post.cfm/configuring-railo-for-the-application-server-part-1

    Or you create a railo mapping named "/" that points to C:\webserver\htdocs so that it serves the same purpose. Only static assets are a problem...

    Gert

    Comment by Gert Franz – December 07, 2011
  2. Hi Gert, Thanks for the comment. I've just tried this and can't get Railo (Jetty) to start up. Which setting is it that I need to change? Thanks!

    Comment by John Whish – December 12, 2011

Leave a comment

If you found this post useful, interesting or just plain wrong, let me know - I like feedback :)

Please note: If you haven't commented before, then your comments will be moderated before they are displayed.

Please subscribe me to any further comments
 

Search

Wish List

Found something helpful & want to say ’thanks‘? Then visit my Amazon Wish List :)

Categories

Recent Posts