Installing Railo for CFML on Tomcat
Railo implements CFML (Cold Fusion Markup Language) and is Open Source. Railo 3.3 is intended to be compatible with Adobe ColdFusion 9 and Railo 3.1.2 was intended to be compatible with Adobe ColdFusion 8.
This is a short tutorial on installing Railo on Tomcat. For the tutorial, we deployed successfully to the following platforms on a standard Metawerx Java Hosting JVM:
- Tomcat 7.0.27, JDK1.6u31
- TomEE 1.0.0-beta-3 WebProfile and Plus editions, JDK1.6u31
Introduction to CFML
CFML is a quick and easy server-side scripting language. Here's a quick example doing a database lookup and displaying all the results.
<cfquery name="getproducts" datasource="mydb">
select name, price from products where id = 100
Some of the benefits of CFML as a development language:
- Simple tags for database lookups, URL parameter handling, HTTP lookup, mail sending, etc...
- Parameterised queries make it easy to avoid SQL-injection attacks and much more (note the above example does not demonstrate this feature
- Rapid development and prototyping
- Can interface with and use Java classes directly
- Easy debugging including the ability to dump entire structures or queries with a single tag
CFML started out as an interpreted language running on a native interpreter, but long ago was rewritten in Java. These days CFM files are converted into Java, then compiled into classes just like JSP.
Cold Fusion Applications have been able to be hosted on Tomcat for a long time using the Cold Fusion WAR method. So why switch to Railo? It's Open Source! No need to purchase licenses, and it runs on top of Tomcat and TomEE straight out of the box. It's also up to version 3.3 and is quite mature now.
- Download Railo Custom from http://www.getrailo.org/index.cfm/download/
- Save it as a WAR file (eg: somename.war or ROOT.war depending on whether you want it to be the main ROOT application or a separate context)
- Upload it to your webapps folder and wait for it to auto-deploy, or deploy it with Tomcat Manager
- Go to the application using your browser, eg: http://tcXXXXX.metawerx.com.au/myRailo
- Secure the new Railo instance immediately by setting a password for the Server Administrator and Web Administrator
- Set a database and mail server if you will use them, and limit the max connections to something suitable (eg: 5)
- Upload your CFML pages or application to a new folder inside the Railo application, or rename index.cfm as something else (eg: admin.cfm) and build your application alongside the admin application
- Other alternatives for CFML are OpenBlueDragon (also Open Source, previously NewAtlanta BlueDragon) and of course Adobe ColdFusion (commercial).
- Neale Rudd, 14-Apr-2012