Hi Heather.  

If I may present my experiences debugging Tomcat apps
using XEmacs/JDEE...

1) The JDE debugger, while cooler than the jdb, is not quite ready for
primetime, IMHO.  The jdb, while boring, seems to be more reliable
debugging servlets on Linux.

2) I've tried the "attach process thing" with Tomcat, and though it
seems to work ok, the debugger is more responsive when I simply run
org.apache.tomcat.startup.Tomcat from within the JDEE after having
deployed my app to $TOMCAT_HOME/webapps.

Here is a typical prj.el file for one of my apps:

(jde-project-file-version "1.0")
(jde-set-variables
 '(jde-db-source-directories (quote ("/usr/local/jdk/src" 
"~/personal/prototypes/receiving/src" "~/src/struts" "~/src/tomcat" "~/src/servlet")))
 '(jde-db-option-properties (quote (("tomcat.home" . "/usr/local/tomcat"))))
 '(jde-run-option-properties (quote (("tomcat.home" . "/usr/local/tomcat"))))
 '(jde-global-classpath (quote ("/usr/local/tomcat/lib" "/usr/local/jdk/lib" 
"/usr/local/tomcat/webapps/receiving/WEB-INF/classes" 
"/usr/local/tomcat/webapps/receiving/WEB-INF/lib")))
 '(jde-run-application-class "org.apache.tomcat.startup.Tomcat"))

That last variable is the key to simply typing C-c C-v C-d while
visiting one of the Java source files beneath your source tree.  Once
the debugger is running, type C-x SPC in your source file to set your
breakpoints. 

Good luck!

Heather Marie Buch <[EMAIL PROTECTED]> writes:

> BTW - At no point to I get the 
> 
> "step into" or "step over" choices. Shouldn't they be available at some
> point after
> I attach the process?
> 
> Thanks,
> 
> Heather
> 
> Jason Rumney wrote:
> > 
> > >  > I am running a servlet application under tomcat (servlet engine) and
> > >  > apache with mod_jk.
> > >  >
> > >  > I modified the tomcat startup file to contain the debug stuff:
> > >  >
> > >  > it starts up:
> > >  >
> > >  > java -classic -Xrunjdwp:transport=dt_socket,address=NNNN,server=y,
> > >  > suspend=n -Xdebug -Dtomcat.home= $MAIN
> > 
> > Presumably you already use a number in place of NNNN above, or it
> > would fail on startup as well.
> > 
> > >  > problem #1
> > >  > tomcat starts ok, but when I shut it down, it complains:
> > >  >
> > >  > "err:: Address already in use
> > >  > Transport dt_socket failed to initialize, rc = -1"
> > 
> > I would recommend setting the debug options in TOMCAT_OPTS in
> > startup.sh, not in tomcat.sh. Otherwise the shutdown command tries to
> > use the same port for debugging, which results in the above error.
> > 
> > The other idea to use ant would also work, but seems like an
> > unnecessary complication to me.
> > 
> > >  > the jdebug documentation tells me what to do if I have solaris +
> > >  > jdk1.3, or linux + jdk1.2.2, but it doesn't specifically say what
> > >  > to do with linux + jdk1.3. So I follow the instructions for
> > >  > solaris + jdk1.3
> > 
> > I think that is the right thing to do.
> > 
> > >  > Execute JDEbug->Processes->Attach Process->Local Host
> > >  > I then enter my socket number (which may or  may not be good)
> > 
> > This is the NNNN number in the debug options, yes? Not one of the
> > other sockets that Tomcat is configured to use.
> > 
> > >  > Then I start my app. in the browser.
> > >  >
> > >  > Then I come back to jdee and nothing happens. I try to do:
> > 
> > Did you set any breakpoints? If not, I wouldn't expect anything
> > visible to happen. I have found that you need to set the breakpoints
> > after attaching the debugger to Tomcat, or they won't work.
> > 
> > >  > Display - local variable, and I get an error
> > 
> > You can only display local variables when you are stepping through
> > (once the breakpoint is hit).
> > 
> > --
> > Jason Rumney
> 
> -- 
> http://www.mit.edu/~hmbuch/
> 
> Heather Marie Buch  [EMAIL PROTECTED]

Reply via email to