"How do you debug a web application running under Tomcat using JDeveloper?"
I like to debug using our Oracle JVM because our debugging and profiling features are faster and richer when using this VM instead of hotspot. Of course we support using and debugging with hotspot as well, but since rarely if ever does a problem that I'm debugging turn out to be a Java VM-related issue, I'll take the faster/richer debugging experience any day. At the moment, using our "Ferrari" Oracle JVM is a Windows-only option, but for JDeveloper 9.0.5 we've ported this instrumented VM to other platforms as well. Our online help goes through the steps of setting up debugging for both Oracle JVM and Hotspot, but if you want the fastest debugging experience and you're on Windows, then you can use a little BAT file like this one to startup Tomcat in a debug-on-demand mode:
@echo off setlocal REM Use the Oracle JVM that's in my JDeveloper 9.0.3.2 install dir set JAVA_HOME=C:\jdev9i\9032\jdk set JAVA_OPTS=-XXdebugondemand pushd C:\apache\jakarta-tomcat-4.1.24\bin call startup popd endlocal
The -XXdebugondemand flag to the VM will startup the Oracle JVM in a mode where you can connect the JDeveloper debugger to it and detach the debugger from it whenever you want. To setup your JDeveloper project for remote debugging, edit the project properties and visit the "Remote" sub-category of the "Debugging" tab in that dialog. Check the "Remote Debugging" box.
Then, to run the debugger and attach to the running Tomcat servlet container, just click on the "Bug" toolbar icon, and indicate the name of the machine and port number where your Tomcat server is running. Taking the defaults will attach to the server-side VM debugger on port 4000. Leaving the "Host:" field blank in the "Debugger - Attach..." dialog will default to the local machine.
When the JDeveloper debugger connects to the Tomcat servlet container, you'll see messages like the following in the JDeveloper log window:
Debugger attempting to connect to remote process at LocalHost 4000. Debugger connected to remote process at LocalHost 4000. Debuggee process virtual machine is OJVM Client VM. Debuggee process is application server Tomcat. To test JSPs or servlets, you must start a browser.
Then just browse a page that will cause your problem to occur to hit whatever breakpoints you have setup.
10:49:15 AM
|