• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Debug a servlet

 
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hallo,

How I can debug a Servlet using the. eclipse ?
Thanks

regards
M
 
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Run your server in debug mode and set a breakpoint.
 
Mihai Radulescu
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Michael

Thanks for your answer, but can you provide more details ?
How to start the tom cat server in the debug mode ?

What I don't understand is even if the tom cat runs in the debug mode my servlet runs in the tom cat's container so I need to start the tom cat under eclipse in the debug mode. Is this statement correct or I miss something ?


Regards,
M
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure about Eclipse' capabilities, but even if the server doesn't run within an IDE, you can use an external debugger like JSwat to debug it.
 
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you can use object of PrintWriter i.e. out
& write
out.println("A");
out.println("B");
out.println("C");

for point where you want to debug the servlet.
So that we got exact point of error in servlet.
 
Mihai Radulescu
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys, thanks for the answer.

Ulf, what you suggest is nothing more than a java debuger, my question is (was) how I get the container to run in to a debuger ?


Vilas, this system.out kind of debug I want to avoid, I'll like a real debuger (with breakpoints, stack tray, etc)

Regards
M
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just start tomcat from within Eclipse, set a breapoint and it works.
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You may need the Tomcat plugin for Eclipse...
 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The System.out was the best easy way I found out to debug my servlet...
 
Mihai Radulescu
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Michael

Which Tomcat plugin you mean ?

Regards,
M
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

You may need the Tomcat plugin for Eclipse...



I do not know how to be more specific than this
 
arch rival
Posts: 2813
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have always found NetBeans to be far easier and more intuitive thn Eclipse for developing and debugging. It is a single download with the tomcat as part of the installation and once you start in debug mode it feels very intuitive.

You create a project as a web application.

http://www.netbeans.org
 
Mihai Radulescu
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, I just try it with net beans and it works. Now I'll try some eclipse plugins.

Regards,
M
[ October 04, 2007: Message edited by: Mihai Radulescu ]
 
Can you hear that? That's my theme music. I don't know where it comes from. Check under this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic