jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes HFSJ Listener - Chapter 5 - /listenerTest/ 404 error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "HFSJ Listener - Chapter 5 - /listenerTest/ 404 error" Watch "HFSJ Listener - Chapter 5 - /listenerTest/ 404 error" New topic

HFSJ Listener - Chapter 5 - /listenerTest/ 404 error

Jesse Perrigo

Joined: Jul 07, 2009
Posts: 2
I've been trying to do the example from the book that starts on page 168.

I'm not having any problems deploying the webapp. The Tomcat Manager tells me the app is deployed and started. However, when I point my browser to http://localhost:8080/listenerTest/ListenTest.do I get the following error:

I've looked over all my code and it seems to match the text from the book.

Here's what my files look like.




As far as the directory structure goes, my class files reside in <tomcat home>\webapps\listenerTest\WEB-INF\classes\com\example and my web.xml file resides in <tomcat home>\webapps\listenerTest\WEB-INF.

I've checked the logs and nothing goofy appears to be going on. The other webapps from earlier in the book still work just fine but this one has been giving me fits all day. I have a feeling I'm missing something really simple but it's just eluding me at this point.

Hopefully a fresh pair of eyes will help.

Thanks in advance for your time.
Soniya Ahuja
Ranch Hand

Joined: Jul 20, 2008
Posts: 83
Hello Jesse,

Well, I copied your code as it is... and it worked! So I think you need to check if the class files etc. are all in place. One more suggestion, with the same web.xml try accessing some other servlet. Map one more servlet in the same web.xml and see if it works.

All the best!

SCJP 1.5 | SCWCD 5 | SCJP 6.0
[url]http://a2zjava.webs.com[/url] - Online training for Java/JSPs and Servlets/SCJP/SCWCD
Jesse Perrigo

Joined: Jul 07, 2009
Posts: 2
Thanks for your reply, Soniya.

I finally got it working. I think maybe my problem was with the text editor I used to create the web.xml file. I had originally created it using EditPad Lite. So I deleted the file and created it again using JCreator and that worked. So I guess I won't be using EditPad for xml files any more.

Thanks again for your help.

I agree. Here's the link: http://aspose.com/file-tools
subject: HFSJ Listener - Chapter 5 - /listenerTest/ 404 error
It's not a secret anymore!