File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Debugging a servlet program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Debugging a servlet program" Watch "Debugging a servlet program" New topic
Author

Debugging a servlet program

anirudh takkallapally
Greenhorn

Joined: Sep 04, 2003
Posts: 14
I have a servlet invoked from an applet , i am trying to debug this servlet program , the communication between the applet and servlet is fine , in the servlet i am trying to create a file ..., which it is not doing ,
basically i would like to know how to view the exceptions that are thrown by the system , i am able to view these exceptions on a tomcat terminal window which comes when i start the server on my standalone windows machine , but there is no terminal window comming on unix machine where i am trying to run the program ,
is there a way to view the exceptions that are generated by the system and how do i view them???
please help
thx..............
Tom Blough
Ranch Hand

Joined: Jul 31, 2003
Posts: 263
Use try/catch blocks in your servlet code and return the error description to the client browser. The exceptions are going to the server because you are not catching them.


Tom Blough<br /> <blockquote><font size="1" face="Verdana, Arial">quote:</font><hr>Cum catapultae proscriptae erunt tum soli proscripti catapultas habebunt.<hr></blockquote>
Michael Bronshteyn
Ranch Hand

Joined: Mar 26, 2002
Posts: 85
To debug servlet you need remote debugging capability. You can use jdb or get some java debuggers which will allow you to do so. Then you need to start your servlet container in the debug mode and attach your debugger to the servlet container. After that you can set breakpoint in your servlet code and debug as normal.


Michael
SCJP2
Brian Pipa
Ranch Hand

Joined: Sep 29, 2003
Posts: 299
You can use one of the many logging APIs and have it write to a file. You can then view the file to see what's happening. You can even setup a JSP or servlet so that you can view that file remotely froim a browser
brian


My Java Freeware:<br />MACCC - <a href="http://maccc.pipasoft.com" target="_blank" rel="nofollow">http://maccc.pipasoft.com</a><br />Nator - <a href="http://nator.pipasoft.com" target="_blank" rel="nofollow">http://nator.pipasoft.com</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Debugging a servlet program