my dog learned polymorphism*
The moose likes Servlets and the fly likes servlet debugging Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet debugging" Watch "servlet debugging" New topic
Author

servlet debugging

jesse harris
Ranch Hand

Joined: Oct 02, 2000
Posts: 62
anyone got any tips on remoteley debugging deployed servlets with websphere and visual age 4,
I have installed the distributed debugger, but cannot get anything fruitful from it. is that the way to go? and if so can anyone offer any tips on getting that going or point me to a decent reference, because as usual IBM has made little effort to help. thanks in advance,
Jesse
Parag Shah
Greenhorn

Joined: Jan 23, 2002
Posts: 26
Jesse,
Maybe you can try another way to perform the debugging. Instead on relying on the remote debugger of an IDE, you can put log statements in you code using Log$J (http://jakarta.apache.org/log4j) and configuring it such that the statements are send to a remote log server. Such a setup will let youremotely debug a servlet or any other application also. I almost always prefer app logs to an IDE's debugger.
Parag


http://diycomputerscience.com
Do It Yourself Computer Science
Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
pshah72,
Javaranch has a naming policy which is strictly enforced. Please read it and change your display name if you wish to continue posting here. Thanks.


Matthew Phillips
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
The debugging chapter from my servlets book can be downloaded from:
http://www.lanw.com/books/servletjsp/
Also my debugging utility for snooping on the exact HTTP transmission between browser and servlet. This can help with remote debugging.
Bill
jesse harris
Ranch Hand

Joined: Oct 02, 2000
Posts: 62
thank you all for your responses,
let me explain my situation further,
I work in a team develpoment environment, we have been developing a web app that is quite hefty, it is a multi tiered application, we have dozens of packages, containing servlet and non-servlet classes used as utilities and data holding/manipulating objects. Every now and then we have the folowing problem, one of us will build on an older version of a class and then export it, leaving some functionality from the newer version lost in space, when this happens the servlet crashes while it is trying to access a class's method or field that does not exist, this is what I need to debug in a deployed environment. we also have problems when DB resources are not available. essentially what I need to do if possible is to connect to websphere and debug the servlets just as if they were running in the webshere test environment in visual age. I have installed the distributed debugger and have had lots of problems instaling and configuring it, also I have been unable to find any helpful reference on this subject, maybe because what I am tring to do is not possible. but if anyone can offer any help or tips it would be greatly appreciated. Mr Brogden, thank you very much for you reference, I have read it, but I need debugging on a code line by code line basis if possible.
thanks in advance for any help.
Jesse
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
OUCH! What a nasty problem!
Don't you get enough information from the exception stack trace to locate the line that causes the exception? Are you using any version control software?
Bill
jesse harris
Ranch Hand

Joined: Oct 02, 2000
Posts: 62
well we are using visual age and the shared repository, but the enviroment we work in often demands quick fixes to things, and often things are exported class-wise and occasionally someone forgets to export some updated utility class, I feel that we could take more advantage of the features of the shared repository but I have yet to see a decent reference for it, if you have any suggestions that would be great. Often what happens is that multiple developers could be working on the project and one developer adds a method to a utility class that he needs, then another deveoper adds fonctionality to the same util class but has not gotten the newest version of the class, now, i can see as I write this that the developers must be checking for newer versions evertime they develop a class. Another part of the problem is knowing what classes you have to export when you add a feature, what I do now is I leave classes that have not been exported as open editions until I am ready to deploy, then as i deploy I version, this works O.K. for me but if i am working on a class I own and I am done developing it but i have not exported, it will be an open edition in my workspace, well other developers are unable to get my new version into their workspace until I version it, but I am not ready to deploy, so I vesion it for the other developers, but if I deployed it the system would crash, so I end up writing notes to myselp to rememeber to export the class, or I create another open edition of it, but that seems incorrect. as for your mention of the "exception stack trace" if possible could you tell me how I could get to that info(I am hoping this applies to web apps and that your not referring to the error messages returned by webshere), the problem we have is that we have developed this project as a web app, with frames and other annoyances and the webserver often does not return decent error messages, it often says the execption occurred in some servlet that calls a dozen other classes or so, and the problem is and old version of one of the supporting classes.
sounds like fun don't it.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
In Tomcat anyway, when a servlet or JSP throws an exception, it gets logged to some sort of file. I'm sure Websphere has some similar facility.
Personally, I like to enclose the main computation parts of doGet and doPost methods in a try-catch and handle the exception with a printStackTrace to a special log file OR if the servlet is supposed to write a HTML page, to the response out stream so you get it on your browser.
Bill
jesse harris
Ranch Hand

Joined: Oct 02, 2000
Posts: 62
all I really want to do is to use the distibuted debugger the way it is described, does anyone have any knowledge of how to install and configure this component, and what the debug enging that has to be on the server side to attach to, is that already installed with webshere?
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Jesse,
WSAD, which (if you are a licensed VAJ user) you have a license to, and should also have the CD for, allows you to easily remotely debug a running WebSphere instance.
See Ahmed Khalifa's articles here:
http://www7b.software.ibm.com/wsdd/library/techarticles/0203_khalifa/khalifa.html
and here:

http://www7b.software.ibm.com/wsdd/library/techarticles/0203_khalifa/khalifa2.html
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
By the way, in general, going to VADD (www.ibm.com/vadd) and doing a search on "remote debug" can be helpful...
Kyle
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: servlet debugging