Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFSJ Listener - Chapter 5 - /listenerTest/ 404 error

 
Jesse Perrigo
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
===
MyServletContextListener.java


Dog.java


ListenerTester.java



web.xml



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
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Jesse Perrigo
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Jesse
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic