Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Debugging within Tomcat
Debugging within Tomcat [message #145806] Thu, 26 February 2004 20:44 Go to next message
Eclipse UserFriend
Originally posted by: lyndon.infomediauk.net

I run Tomcat (4.1.18) and set a breakpoint in the Debug Perspective in a
servlet. I make a request from the browser and the line where the
breakpoint is highlights. I then click on the step over button and the
whole perspective changes to Java. There must be something I'm doing wrong
but I can't work it out.

Any ideas?

TIA

Lyndon
Re: Debugging within Tomcat [message #145841 is a reply to message #145806] Thu, 26 February 2004 21:41 Go to previous messageGo to next message
Miguel Griffa is currently offline Miguel GriffaFriend
Messages: 118
Registered: July 2009
Senior Member
Lyndon Smiyh wrote:
> I run Tomcat (4.1.18) and set a breakpoint in the Debug Perspective in a
> servlet. I make a request from the browser and the line where the
> breakpoint is highlights. I then click on the step over button and the
> whole perspective changes to Java. There must be something I'm doing wrong
> but I can't work it out.
>
> Any ideas?
>
> TIA
>
> Lyndon
>

pasted from doc

Remote debugging web applications
Miguel Griffa, January 2004

Requirements
Eclipse 3.0 M6
Jakarta tomcat 5.x (probably applies to tomcat 4.x too)
java SE 1.4 (recommended)
Debian GNU/Linux (any *NIX system with bash should be almost identical)
The TOMCAT_HOME environment variable is properly set1
familiarity with the eclipse debugging environment
Introduction
This document explains how to debug a web application running in tomcat.
This method of debugging is recommended since it can be applied to
remote debugging applications in other environments such as Jboss.
The procedure for remote debugging an application in tomcat is as follows:
1.tomcat is started with special flags, indicating the JVM will open a
port to listen debugger commands
2.Eclipse is set up to remote debug an application
3.Eclipse hooks to the tomcat process and debugging starts

NOTE: Do not do this in any production environment since:
1.This mode consumes a lot or extra resources
2.It is extremely dangerous and provides a big security hole

Before you start, if you never debugged an application in eclipse, it is
recommended that you create a simple java project and play around with
the debugger locally.
Setting up tomcat
In a terminal (assumes the bash shell) run the following commands
export JPDA_ADDRESS=8999
export JPDA_TRANSPORT=dt_socket
$TOMCAT_HOME/bin/catalina.sh jpda run2
Believe it or not, this is all that is required to start tomcat enabling
remote debug.
Setting up eclipse
The tomcat process should be running and listening for connections, on
eclipse, open run -> debug, click on the remote java application. Here
you can add the project that contains the source file you want to debug,
note that the port is 8999 as set on JPDA_ADDRESS when starting tomcat.
Set breakpoints and invoke the process on tomcat normally, you should be
able to follow the code in the debugger normally.
Re: Debugging within Tomcat [message #146373 is a reply to message #145841] Sun, 29 February 2004 16:12 Go to previous messageGo to next message
Sundar Narasimhan is currently offline Sundar NarasimhanFriend
Messages: 7
Registered: July 2009
Junior Member
Hi, Miguel: I have a related problem. Thanks for your informative note, btw.

What I'm trying to do is to "attach" the tomcat source so my debugger
can step into it. I've unbundled it and pointed the source folder to
$tomcat/catalina/src/share.. but yet I don't see it stepping into the
tomcat source.

What am I missing?
Thanks.
Miguel Griffa wrote:
> Lyndon Smiyh wrote:
>
>> I run Tomcat (4.1.18) and set a breakpoint in the Debug Perspective in a
>> servlet. I make a request from the browser and the line where the
>> breakpoint is highlights. I then click on the step over button and the
>> whole perspective changes to Java. There must be something I'm doing
>> wrong
>> but I can't work it out.
>>
>> Any ideas?
>>
>> TIA
>>
>> Lyndon
>>
>
> pasted from doc
>
> Remote debugging web applications
> Miguel Griffa, January 2004
>
> Requirements
> Eclipse 3.0 M6
> Jakarta tomcat 5.x (probably applies to tomcat 4.x too)
> java SE 1.4 (recommended)
> Debian GNU/Linux (any *NIX system with bash should be almost identical)
> The TOMCAT_HOME environment variable is properly set1
> familiarity with the eclipse debugging environment
> Introduction
> This document explains how to debug a web application running in tomcat.
> This method of debugging is recommended since it can be applied to
> remote debugging applications in other environments such as Jboss.
> The procedure for remote debugging an application in tomcat is as follows:
> 1.tomcat is started with special flags, indicating the JVM will open a
> port to listen debugger commands
> 2.Eclipse is set up to remote debug an application
> 3.Eclipse hooks to the tomcat process and debugging starts
>
> NOTE: Do not do this in any production environment since:
> 1.This mode consumes a lot or extra resources
> 2.It is extremely dangerous and provides a big security hole
>
> Before you start, if you never debugged an application in eclipse, it is
> recommended that you create a simple java project and play around with
> the debugger locally.
> Setting up tomcat
> In a terminal (assumes the bash shell) run the following commands
> export JPDA_ADDRESS=8999
> export JPDA_TRANSPORT=dt_socket
> $TOMCAT_HOME/bin/catalina.sh jpda run2
> Believe it or not, this is all that is required to start tomcat enabling
> remote debug.
> Setting up eclipse
> The tomcat process should be running and listening for connections, on
> eclipse, open run -> debug, click on the remote java application. Here
> you can add the project that contains the source file you want to debug,
> note that the port is 8999 as set on JPDA_ADDRESS when starting tomcat.
> Set breakpoints and invoke the process on tomcat normally, you should be
> able to follow the code in the debugger normally.
Re: Debugging within Tomcat [message #146570 is a reply to message #146373] Mon, 01 March 2004 17:59 Go to previous message
Miguel Griffa is currently offline Miguel GriffaFriend
Messages: 118
Registered: July 2009
Senior Member
Run normally
when debugging, eclipse will prompt for missing sources,
when prompted
goto add directory and add tomcat-src (wherever it is)
it should work without problems

Sundar Narasimhan wrote:
> Hi, Miguel: I have a related problem. Thanks for your informative note,
> btw.
>
> What I'm trying to do is to "attach" the tomcat source so my debugger
> can step into it. I've unbundled it and pointed the source folder to
> $tomcat/catalina/src/share.. but yet I don't see it stepping into the
> tomcat source.
>
> What am I missing?
> Thanks.
> Miguel Griffa wrote:
>
>> Lyndon Smiyh wrote:
>>
>>> I run Tomcat (4.1.18) and set a breakpoint in the Debug Perspective in a
>>> servlet. I make a request from the browser and the line where the
>>> breakpoint is highlights. I then click on the step over button and the
>>> whole perspective changes to Java. There must be something I'm doing
>>> wrong
>>> but I can't work it out.
>>>
>>> Any ideas?
>>>
>>> TIA
>>>
>>> Lyndon
>>>
>>
>> pasted from doc
>>
>> Remote debugging web applications
>> Miguel Griffa, January 2004
>>
>> Requirements
>> Eclipse 3.0 M6
>> Jakarta tomcat 5.x (probably applies to tomcat 4.x too)
>> java SE 1.4 (recommended)
>> Debian GNU/Linux (any *NIX system with bash should be almost identical)
>> The TOMCAT_HOME environment variable is properly set1
>> familiarity with the eclipse debugging environment
>> Introduction
>> This document explains how to debug a web application running in
>> tomcat. This method of debugging is recommended since it can be
>> applied to remote debugging applications in other environments such as
>> Jboss.
>> The procedure for remote debugging an application in tomcat is as
>> follows:
>> 1.tomcat is started with special flags, indicating the JVM will open a
>> port to listen debugger commands
>> 2.Eclipse is set up to remote debug an application
>> 3.Eclipse hooks to the tomcat process and debugging starts
>>
>> NOTE: Do not do this in any production environment since:
>> 1.This mode consumes a lot or extra resources
>> 2.It is extremely dangerous and provides a big security hole
>>
>> Before you start, if you never debugged an application in eclipse, it
>> is recommended that you create a simple java project and play around
>> with the debugger locally.
>> Setting up tomcat
>> In a terminal (assumes the bash shell) run the following commands
>> export JPDA_ADDRESS=8999
>> export JPDA_TRANSPORT=dt_socket
>> $TOMCAT_HOME/bin/catalina.sh jpda run2
>> Believe it or not, this is all that is required to start tomcat
>> enabling remote debug.
>> Setting up eclipse
>> The tomcat process should be running and listening for connections, on
>> eclipse, open run -> debug, click on the remote java application. Here
>> you can add the project that contains the source file you want to
>> debug, note that the port is 8999 as set on JPDA_ADDRESS when starting
>> tomcat. Set breakpoints and invoke the process on tomcat normally, you
>> should be able to follow the code in the debugger normally.
>
>
Previous Topic:PDE Tools - Create Ant Build file from command line?
Next Topic:JavaDocs for JDT 3.x
Goto Forum:
  


Current Time: Tue Jul 30 19:31:45 GMT 2024

Powered by FUDForum. Page generated in 0.04056 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top