cfml

Embed a Railo ColdFusion/CFML Server
within your CFEclipse/Eclipse application with no need for XML configurations

Reading time of 871 words
4 minutes
Reading time of 871 words ~ 4 minutes


Did you find this article helpful?
Please consider tipping me a coffee as a thank you.
Ko-fi Buy Me a Coffee
Did you find this article helpful? Please consider tipping me a coffee or three as a thank you.
Tip using Ko-fi or Buy Me a Coffee

This entry will walk you through step by step to enable you from within Eclipse to start and shutdown a custom install of the open source CFML engine Railo running off Apache Tomcat. Most importantly though you will be able to implement this without the need of touching any fickle XML Tomcat configuration files.

This article was written in mind with the CFEclipse add-on running off Eclipse Helios. I have not tested these steps with Adobe’s proprietary CFBuilder.

Eclipse: http://www.eclipse.org/downloads/compare.php CFEclipse: http://cfeclipse.org

Let’s start.

Visit Apache Tomcat and download your appropriate edition under the Core section. Windows users should download either the 32-bit or 64-bit Windows zip but not the Service Installer.

Tomcat 7: http://tomcat.apache.org/download-70.cgi Tomcat 6: http://tomcat.apache.org/download-60.cgi

Extract the downloaded zip containing Apache and then move the created apache-tomcat-7.*.* directory to a location of your choice. In this example I will move it to my server collection under W:\Dev\Server\.

Go to the Railo download page and fetch the latest Current stable release Railo Custom WAR Archive under the ALL OS.

Railo: http://www.getrailo.org/index.cfm/download


Using 7-Zip or some other WAR compatible archive tool extract the downloaded Railo-3.*.* WAR archive.

7-Zip: http://www.7-zip.org

Now create a working resource directory for your CFEclipse project. I will use W:\Railo\Test\.

Copy the content of the extracted WAR archive to your project resource directory.


Start Eclipse.

From the pull-down menu select Window > Preferences then Server > Runtime Environment and select Add.


In the New Server Runtime Environment dialog select your appropriate Apache Tomcat version and select Next >. If you cannot see an Apache folder containing various Tomcat versions you will need to click the Download additional server adapters link and follow the Install New Extension wizard.


Give your Tomcat Server a name and point it to your Tomcat installation directory.


Click the Installed JREs… button and in the Installed JREs dialog select Add. In the Add JRE wizard select Add and point the JRE home: input to your local Java Runtime Environment location. This is often either C:\Program Files\Java\jre6 or C:\Program Files (x86)\Java\jre6. If you downloaded the 64-bit edition of Tomcat you will need to point to the 64-bit Java RE that is installed on your machine. Once done select the Finish button and then the OK button in the Installed JREs dialog.

Java Runtime Environment: http://java.com/en/download/manual.jsp


Now make sure the New Server Runtime Environment has your installed JRE selected and not the Workbench default JRE and press Finish. Press OK in the Server Runtime Environments dialog.


Now we need to bring up the Eclipse Servers view. From the Eclipse pull-down menu select Window > Show View > Other > Server > Servers and press OK. The Servers tab should now be selected, right click on the Servers pane and select New > Server.


In the Define a New Server dialog select your Apache Tomcat server type. Give the server a Server name, keep the host name as localhost, make sure the Server runtime environment is correct and select Finish.


You should have a new entry in your Servers tab. Double left-click it to bring up the server’s Overview tab.


Under Server Locations select the Use Tomcat installation option. The Deploy path should be set to webapps and then save the changes using Ctrl+S.


Now select the Modules tab in the Overview and press the Add External Web Module… button. Point the document base to your Railo working resource directory in my case it is W:\Railo\Test\ but keep the path as / and press OK. Save the updated Web Modules using Ctrl+S.



Back to the Servers tab select your server, right click and select Start. Eclipse should automatically switch tabs to the Console as the server starts before reverting you back to the Servers. The server should have a revised status saying Started, Synchronized.



Point your web browser to http://localhost:8080/and you should have the Railo Welcome page. To shut down your server select it under the Eclipse Servers tab, right-click and select Stop. Congratulations you have a working embedded Tomcat Railo server operating within Eclipse.

Next we will create a CFEclipse project and a simple Hello World application otherwise you can end the tutorial here.

In Eclipse pull-down Window and select Show View > Project Explorer.


Right click on the Project Explorer pane and select New > Project to bring up the New Project wizard. Open the CFEclipse folder and selected CFML Project and press Next.



Give your CFEclipse Project a Project name and then deselect the Use default location checkbox. Select the location of your working resource directory where you placed your Railo installation. For me it was W:\Railo\Test\ and then Finish.


Open your newly created project from the Project Explorer, right-click and select New > File. Create a new file named hello.cfm in your project and Finish. Edit the hello.cfm and add the following mark-up and save using Ctrl+S.

<cfdump var="Hello world!">




In the Servers tab start your server. Once it has loaded select from the Eclipse pull-down menu Window and then Show View > Browser View. Under the Project browser tab enter the URL http://localhost:8080/hello.cfm and you should see a dump of text Hello world!.


Now you are ready to develop, test and troubleshoot your ColdFusion Mark-up all contained within the Eclipse environment.

Written by Ben Garrett

Did you find this article helpful?
Please consider tipping me a coffee as a thank you.
Ko-fi Buy Me a Coffee
Did you find this article helpful? Please consider tipping me a coffee or three as a thank you.
Tip using Ko-fi or Buy Me a Coffee