aspose file tools*
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
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet debugging" Watch "servlet debugging" New topic
Author

servlet debugging

Neo Wills
Ranch Hand

Joined: Nov 29, 2006
Posts: 40
Hi,
I am running tomcat6. A request is sent from the javascript client end to the servlet through the get method. But I dont see the servlet code getting executed. Is there a way to debug this piece of communication?

I dont see any errors in the tomcat logs either.

Bharath
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
if you use eclipse simply add a breakpoint. If you don't, add some System outs in the method body, or simply use eclipse


JDBCSupport - An easy to use, light-weight JDBC framework -
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60980
    
  65

Sebastian Janisch wrote:System outs ...

System outs? Dude! Log4J!

Install Firebug in Firefox so you can see the Ajax request in action. You can also install HttpFox to see all of the requests and responses.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Neo Wills
Ranch Hand

Joined: Nov 29, 2006
Posts: 40
Thanks. Looks like the get request is not issued at all (atleast thats what the httpfox is hinting as I dont see any requests in it).

If I execute my servlet directly from my browser say like: http://localhost:8080/abc/cde/HelloWorldExample it works.

The java script is present outside the WEB-INF directory inside abc. And I pass the URL as /cde/HelloWorldExample. Is there anything wrong in this?

This is the code in js:



And my servlet code, just prints Hello world on my screen:


I expect to see the Helloworld on the click (which invokes the open and send calls). But that doesnt happen. The files on the dir structure are :

ABC
----- index.html, index.js
----- WEB-INF
--------- web.xml
--------- CLASSES
--------------- CDE (package for the class)
--------------- HelloWorldExample.class

Should I create a jar file and package them together (is that what is missing)?

Bharath
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
Bear Bibeault wrote:
Sebastian Janisch wrote:System outs ...

System outs? Dude! Log4J!

Install Firebug in Firefox so you can see the Ajax request in action. You can also install HttpFox to see all of the requests and responses.


What do I know how to debug on the server side if you don't use Eclipse. I know it's retarded :-D.
Neo Wills
Ranch Hand

Joined: Nov 29, 2006
Posts: 40
Thanks a lot folks. My bad with the get request. The request was not sent on ajax due to some bad return value. Httpfox really helped with this .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: servlet debugging