Sujit Pal's Blog
This article contains some settings I use for remote debugging web applications using the Jetty and Tomcat containers, and profiling web applications deployed on a remote Tomcat server, using the Eclipse IDE. By remote I mean connecting over a socket, the container can (and does in my case, unless I am connecting from home) listen on a port on the local host. The stuff here is hardly original, it has been gleaned from various web pages and blogs, which I reference in the appropriate places. If you use (or are considering using) Eclipse and want to know how to do remote debugging and profiling, this information may be of some use to you.
Debugging
I have been using the Eclipse IDE (with the MyEclipse extension) for about 3 years now. Most of the time, when debugging, I just use logger.debug() calls within the code to see whats going on. I do know how to debug using the Eclipse Debug perspective, but I guess it's just a habit I developed, and old habits die hard. I don't even use Eclipse's CVS perspective anymore, based on some bad experiences at a previous company where I tried but ended up inadvertently removing from CVS code that I removed locally in my IDE (it was incorrect usage on my part). However, lately, I am starting to find debugging very useful, mainly because of the long stop-deploy-start cycle for our main web application.
Unlike a lot of IDE users, I like to run my web container from the command line rather than from the IDE. This is because of two reasons. First, I think the primary goal should be being able to build a WAR file using Ant (or Maven) and being able to deploy to a container. A lot of IDEs make you go through various hoops to make the webapp "compliant", where the definition of what constitutes compliance can vary from IDE to IDE. As an Eclipse user, I have been a minority at my last two jobs, where the majority of Java developers use IDEA, so it usually turns out that I have to make Eclipse comply with what IDEA thinks is a webapp. Second, having to stop and restart the app within a container running within your IDE involves using your mouse (or in case of a laptop, your touchpad), which is way less convenient than the command line with command-history enabled.
We run and develop our main web application using Tomcat. I have been building Maven apps for quite a while now, and I tend to use the Maven-Jetty plugin because its so much more convenient. For Maven webapps, I tend to do most of my development using Jetty, then deploy to the Tomcat server. The upshot is that I need to be able to debug using remote Tomcat and Jetty instances.
Remote Debugging with Tomcat
The information here is from the Tomcat FAQ Wiki. Basically, you add this in to the $CATALINA_HOME/bin/setenv.sh file. My CATALINA_HOME is at /opt/apache-tomcat-5.5.25. If you already have a JAVA_OPTS defined for application-specific stuff, just add the stuff below to your JAVA_OPTS.
# /opt/apache-tomcat-5.5.25/bin/setenv.sh export JAVA_OPTS="-Xdebug \ -Xrunjdwp:transport=dt_socket,address=8787,
server=y,suspend=n"
The address=8787 enables a debug listener on Tomcat that Eclipse can connect to to get debug information. On the Eclipse, side, open the Debug Launch Configuration Dialog by clicking "Run > Open Debug Dialog". On the left pane of the dialog, find "Remote Java Application", select and right-click (or click on the New icon on the top). This will open up a Dialog for setting parameters for a Debug Launch configuration. Here are my values:








.gif)
It's only taken Borland
two years but it's
finally dumped its
CodeGear tools division,
responsible for Borland's
hereditary JBuilder,
Delphi and C++ Builder
lines as well as its new
web ventures into PHP and
Ruby, said to be used by
7.5 million developers.
Embarcadero Technologies
is b
According to Sean Walsh,
President and CEO of
Skyway Software, 'Our
Skyway Community is
thriving and our members
are very talented. We
truly look forward to
their RIAs submittals and
Skyway Builder extensions
and are excited that all
of the contributions will
benefit the entire Skyway
Brian Stevens, the Chief
Technology Officer and
Vice President of
Engineering of Red Hat,
delivered his
Virtualization Keynote
'The Future of the
Virtual Enterprise' at
SYS-CON's Virtualization
Conference & Expo 2007
West in San Francisco.
'Virtualization is the
hottest subject today,
From Application
Virtualization to Xen, a
round-up of the
virtualization themes &
topics being discussed in
NYC June 23-24, 2008 by
the world-class speaker
faculty at the 3rd
International
Virtualization Conference
& Expo being held by
SYS-CON Events in The
Roosevelt Hotel, in
midtown
Red Hat is a trusted
open source provider.
Red Hat offers enterprise
customers a long-term
plan for building
infrastructures on the
quality and innovation of
open source. Combining
open source operating
system platform, Red Hat
Enterprise Linux,
together with
applications, management










