Approaches to debugging Java CFX tags
259
Approaches to debugging Java CFX tags
Java CFX tags are not stand-alone applications that run in their own process, like typical Java
applications. Rather, they are created and invoked from an existing process. This makes
debugging Java CFX tags more difficult, because you cannot use an interactive debugger to debug
Java classes that have been loaded by another process.
To overcome this limitation, you can use one of the following techniques:
•
Debug the CFX tag while it is running within ColdFusion MX by outputting the debug
information as needed.
•
Debug the CFX tag using a Java IDE (Integrated Development Environment) that supports
debugging features, such as setting breakpoints, stepping through your code, and displaying
variable values.
•
Debug the request in an interactive debugger offline from ColdFusion MX using the special
com.allaire.cfx debugging classes.
Outputting debugging information
Before using interactive debuggers became the norm, programmers typically debugged their
programs by inserting output statements in their programs to indicate information such as
variable values and control paths taken. Often, when a new platform emerges, this technique
comes back into vogue while programmers wait for more sophisticated debugging technology to
develop for the platform.
If you need to debug a Java CFX tag while running against a live production server, this is the
technique you must use. In addition to outputting debugging text using the
Response.write
method, you can also call your Java CFX tag with the
debug="On"
attribute. This attribute flags
the CFX tag that the request is running in debug mode and therefore should output additional
extended debugging information. For example, to call the
HelloColdFusion
CFX tag in
debugging mode, use the following CFML code:
<cfx_HelloColdFusion name="Robert" debug="On">
To determine whether a CFX tag is invoked with the
debug
attribute, use the
Request.debug
method. To write debugging output in a special debugging block after the tag finishes executing,
use the
Response.writeDebug
method. For information on using these methods, see
Chapter 5,
“ColdFusion Java CFX Reference,”
in
CFML Reference
.
Debugging in a Java IDE
You can use a Java IDE to debug your Java CFX tags. This means you can develop your Java CFX
tag and debug it in a single environment.
To use a Java IDE to debug your CFX tag:
1
Start your IDE.
2
In the project properties (or your IDE's project setting), make
sure your CFX class is in the
web_root
\WEB-INF\classes
directory or in the system classpath.
3
Make sure the libraries
cf_root
\lib\cfx.jar and
cf_root
\runtime\lib\jrun.jar are included in your
classpath.
4
In your project settings, set your main class to
jrunx.kernel.JRun and application parameters to
-start
default
.
Summary of Contents for ColdFusion MX
Page 1: ...Developing ColdFusion MX Applications...
Page 22: ...22 Contents...
Page 38: ......
Page 52: ...52 Chapter 2 Elements of CFML...
Page 162: ......
Page 218: ...218 Chapter 10 Writing and Calling User Defined Functions...
Page 250: ...250 Chapter 11 Building and Using ColdFusion Components...
Page 264: ...264 Chapter 12 Building Custom CFXAPI Tags...
Page 266: ......
Page 314: ...314 Chapter 14 Handling Errors...
Page 344: ...344 Chapter 15 Using Persistent Data and Locking...
Page 349: ...About user security 349...
Page 357: ...Security scenarios 357...
Page 370: ...370 Chapter 16 Securing Applications...
Page 388: ...388 Chapter 17 Developing Globalized Applications...
Page 408: ...408 Chapter 18 Debugging and Troubleshooting Applications...
Page 410: ......
Page 426: ...426 Chapter 19 Introduction to Databases and SQL...
Page 476: ...476 Chapter 22 Using Query of Queries...
Page 534: ...534 Chapter 24 Building a Search Interface...
Page 556: ...556 Chapter 25 Using Verity Search Expressions...
Page 558: ......
Page 582: ...582 Chapter 26 Retrieving and Formatting Data...
Page 668: ......
Page 734: ...734 Chapter 32 Using Web Services...
Page 760: ...760 Chapter 33 Integrating J2EE and Java Elements in CFML Applications...
Page 786: ...786 Chapter 34 Integrating COM and CORBA Objects in CFML Applications...
Page 788: ......