I ran into a situation while working on a MachII application running on Railo 3.1 where I REALLY need to see what was going on with the various variable scopes during the request cycle, so I decided tonight to see if I could get FusionDebug 3 Beta up and running with Railo and Tomcat.
For the past couple of months, I’ve been running my CFML server engines (yes engines, plural) on top of Tomcat on my local development environment. This offers me, as an independent developer that works on a number of different client projects, a great deal of flexibility in matching a particular client’s production configuration. Also lately, I’ve been working on a couple of projects using Railo 3.1 as well as a project for a client that still uses CFMX 7. One of the things that I really missed when not developing with ColdFusion 8 is the step debugger that ships with CF8. I’d used FusionDebug some time ago with CFMX 7 when I was running it on top of JRun 4 but had never gotten around to getting it configured under my current, Tomcat-based setup.
Before we get started, I want to detail my particular setup and lay out some assumptions. My environment consists of the following components. Yours might be slightly different, but the basics should be the same.
Now for some assumptions:
The first thing that you have to do is tell Tomcat to enable debugging on a specific TCP port. For this example the port number that we’re going to use is 8000 (the same as the documentation on the FusionDebug site). You do this by adding the following line of code to the catalina.sh file in the /bin folder under the Tomcat install directory (in my case /opt/tomcat/bin/catalina.sh). I added it directly under the large comment block at the top of the file.
If you’re on Windows, this file is named catalina.bat and the format is slightly different:
Save the file and launch Tomcat. In my case, I launched it in a terminal window so I could see exactly what was going on using the command:
cd /opt/tomcat/bin sudo ./catalina.sh run
If everything worked correctly, you’ll see the following line near the top of the output to the console:
Listening for transport dt_socket at address: 8000
That concludes the configuration necessary on the Tomcat side.
Now we need to get FusionDebug configured to connect to that port. In Eclipse, go to Window > Open Perspective > Other and choose FusionDebug from the list that appears in the popup window.
Then you’ll need to open up the Debug Configurations panel by going to Run > Debug Configurations. Find the entry for Fusion Debug in the left side, right click on it and choose “New” from the context menu. Enter a descriptive string in the Name: block at the top of the left side of the screen (I used simply Localhost). Then move to the configuration panel below with the 3 tabs (Connect, Source Code Lookup, and Common).
On the connect tab, enter localhost in the Host: block and 8000 in the Port: block.
On the Source Code Lookup tab, in the drop list that says “<All Projects>”, choose the Eclipse project that contains your files. In the drop list just to the right of the Project select box you just clicked on, choose the folder that corresponds to the web root of your site. Finally, enter the full file system path that corresponds to the folder you just chose and click the Add button. Click the Apply button to save the configuration. You can then click the Debug button at the bottom of the screen to start the debug session. If all goes well, you’ll see “FusionDebug (localhost:8000) (Connected)” in the Debug pane.
Now it’s just a matter of creating a test.cfm file (or using an existing file), setting some breakpoints and browsing to the file and you should see the execution stop at your breakpoint and be able to browse through the list.
|Components:||Connector for Railo|