4 min read

Open Bluedragon Eclipse WAR Project

Here is a quick tutorial to get an instance of OpenBluedragon set up in your Eclipse IDE and testing on a local installation of Apache Tomcat.
Open Bluedragon Eclipse WAR Project
Photo by Mendar Bouchali / Unsplash

I'm using the JEE Eclipse version which contains all the plugins needed to run the sample below.

You'll also need to download and unpack the Apache Tomcat binaries.

Open Eclipse and from the "File" menu choose "New -> Other ->" and then "Web -> Dynamic Web Project" from the New Project Wizard window.

Enter "OpenBDWar" as the Project Name.

Under the Target Runtime setting choose "New...". From the "New Runtime" settings window choose the "Apache -> Apache Tomcat 6" ( or the corresponding version number you have downloaded ) and click the "Next..." button.

eclipse new server runtime apache 6

In the next settings window, chose the path to the root folder where you downloaded and unpacked Apache Tomcat. The root folder is the top folder that contains the bin, lib, and webapps folders.

[caption id="attachment_12" align="alignnone" width="445" caption="eclipse new server runtime apache 6 setup"]

eclipse new server runtime apache 6 setup

Click "Finish" and you will be taken back to the New Project setup window. The runtime should now have Apache Tomcat listed as the target runtime and configuration. Click "Finish" in the new project window to accept the settings ( advanced users: you may "Next..." through the rest of the settings for the new project but the defaults should suffice for what we're doing ).

eclipse new dynamic project

You should now have a new project in your Project Explorer that resembles the layout below.

openbdwar eclipse project layout

Next we'll need to download Open Bluedragon and integrate it into our new OpenBDWar project.

Download the openbluedragon.war and extract it to a new folder; we'll use openbluedragonwarfolder for this example.

$> cd openbluedragonwarfolder

$> jar -xvf openbluedragon.war

The openbluedragonwarfolder should now contain an index.cfm and index.jsp file, a bluedragon and WEB-INF folder and the original openbluedragon.war.

Copy all the folders inside the WEB-INF folder to your WebContent/WEB-INF folder inside your OpenBDWar project in Eclipse. Do not copy the web.xml file as we'll update it by hand next. You may be prompted to overwrite the WEB-INF/lib folder if it exists.

Next copy the index.cfm and index.jsp files and the bluedragon folder inside the extracted openbluedragonwarfolder and paste them into the WebContent folder inside your OpenBDWar project.

Now we'll need to update the web.xml file manually. Open the WebContent/WEB-INF/web.xml file in Eclipse and update it to look like the file below.

OpenBDWar com.naryx.tagfusion.cfm.application.cfHttpSessionListener cfmServlet com.naryx.tagfusion.cfm.cfServlet BLUEDRAGON_WORKING_DIRECTORY /WEB-INF/bluedragon/work BLUEDRAGON_XML /WEB-INF/bluedragon/bluedragon.xml 1 cfcServlet com.naryx.tagfusion.cfm.cfcServlet 2 cfchartServlet com.naryx.tagfusion.cfm.cfchartServlet cfmServlet *.cfm cfcServlet *.cfc cfchartServlet *.cfchart 30 txt text/plain pdf application/pdf swf application/x-shockwave-flash gif image/gif jpeg image/jpeg svg image/svg+xml html text/html xml text/xml htm text/html jpg image/jpeg css text/css index.html index.htm index.jsp index.cfm default.html default.htm default.jsp default.cfm

Save and Close the web.xml.

The project should now be configured to run your CFML applications with the default OpenBluedragon settings. You can edit the WEB-INF/bluedragon/bluedragon.xml file to fit your needs. See Openbluedragon Google groups for bluedragon.xml configuration settings.

You can test your installation with the local Apache Tomcat server we configured earlier by right-mouse clicking on the OpenBDWar project in Eclipse and choosing "Run As... -> Run on Server" and selecting the Apache Tomcat server from the list of servers on localhost. Check the "Always use this server when running this project" check box so that you don't have to specify this each time and then click finish.

eclipse run on server apache

You'll see the log messages in Eclipse's console window as Eclipse starts and configures Tomcat with your OpenBDWar webapp.

Once the server starts Eclipse should open up it's integrated with the browser with the webapp's root and you should see the index.jsp. Enter http://localhost:8080/OpenBDWar/index.cfm in the location bar and hit enter to view the index.cfm page.

You can then start adding .cfm and .cfc CFML files to your project under the WebContent folder in your OpenBDWar project and view them by navigating to their respective URL in the browser.

You do not need to restart the server to modify your CFML pages, the changes are automatically picked up by the deployment as long as you don't have any caching enabled.