Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trace with Eclipse

 
SYong may
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all

anybody can help me how to trace when running the project in eclipse.
I run a project of using Tomcat4.1,xml mapping,servlet,jsp and javascript.I can run that but I want to trace line by line like in VB using F8.
And I want to see the variable value in project.How can I do that?

Thanks
 
Tim West
Ranch Hand
Posts: 539
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like you want to use remote debugging.

You'll need to start the project JVM with debug options like these: -Xrunjdwp:transport=dt_socket,address=7500

Then create a new remote debugging task in Eclipse (Run->Debug...->click on 'Remote Java Application'->click New) and set it up from there.

Then start your app and launch the debugging task.

That's a pretty quick summary - the doco that comes with Eclipse is pretty good on remote debugging so if you get stuck, try there.


-Tim
 
SYong may
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Tim

I do your suggestion.But how do I Start remote VM and port?Please
tell me detail step to do.

Just now I get this message.

failed to debug to remote VM Connection refused.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or you could "simply" install and configure the Sysdeo Tomcat plugin and let it do the rest for you...
 
Tim West
Ranch Hand
Posts: 539
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following work for me:

'Debug' instance - connection type 'Standard (Socket Attach)', host localhost, port 8000.

JVM startup parameter (which happens to be passed in via an Ant task):

"-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"

Now, start the server like normal. When you want to debug, run the debug task and it will try to connect to the JVM instance. The important thing is that you start the server like normal before you try to debug - running the debug task won't start the server for you.

I imagine that if you had some sort of firewall program it might block the port...I'd guess in this case you can set it to allow connections from localhost...

Hope that helps,


-Tim

(Edit: make the port numbers match)
[ August 10, 2004: Message edited by: Tim West ]
 
SYong may
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim

I can't do again.I run the jvm as you write and start the tomcat.
And run->debug debug the project.

But the same error .

Fail to connect to remote vm.Connection refused.
 
Patrick Cogan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to set the aplication server to accept dedug requests (see above details describe this) and you need to tell eclipse where to fire the debug requests. Do this by run>debug. click on Remote java appliaction and then fill in the details.

...and Bob should then be your uncle.

see this thread as well:
http://www.coderanch.com/t/94916/Testing/Debug-ee-application
[ August 19, 2004: Message edited by: Patrick Cogan ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic