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.


Yes, I do "netstat -a" and find a socket that isn't on that list. Lately
I have been
using 2112, but I always do use a number.
> 
> >  > 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.
> 
I'm sorry, but could you please give me the syntax for setting it in
startup.sh?

I tried just writing the line 

TOMCAT_OPTS=value

and commenting out where it sets TOMCAT_OPTS in tomcat.sh, but when
tomcat starts, it shows
that it is starting without any opts. So I need a way to actually
communicate the TOMCAT_OPTS that
are set in startup.sh to tomcat.sh, I guess.

Also, even when I set the TOMCAT_OPTS in tomcat.sh and start tomcat, and
it echos that the opts
are set to the debugging stuff, when I run netstat -a it doesn't show my
tomcat socket number, so
is tomcat really running on that socket?

> >  > 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.

yes

> 
> >  > 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.


OK, here I'm a little confused.

Is this what I would do?

startup tomcat and apache with debugging opts
go into emacs, open the java file
start jdedebug
attach process
set breakpoint
open servlet in browser

then what?

Or would I open the servlet in the browser in between attaching and
setting the breakpoint?

So, it looks like now I just need a way to make sure tomcat is starting
on that socket, and
the proper order to run the debugging.

> 
> >  > 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

Thanks again!

-- 
http://www.mit.edu/~hmbuch/

Heather Marie Buch  [EMAIL PROTECTED]

Reply via email to