• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP Status 404 - /ListenerTest//ListenTest.do

 
Arend van der Kolk
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Many have gone before me and i have read through their solutions you guys handed to them. But my error is not solved by these answers.

Here are my .class files and the locations they are in. Also the log file that clearly states "java.lang.ClassNotFoundException: com.example.MyServletContextListener"

Please help me move forward. Thanks a lot.

web.xml


MyServletContextListener



ListenerTester

Dog


logging in localhost.2016-08-25.log

Locations
C:\Tomcat\webapps\listenerTest\classes\com\example\Dog.class
C:\Tomcat\webapps\listenerTest\classes\com\example\ListenerTester.class
C:\Tomcat\webapps\listenerTest\classes\com\example\MyServletContextListener.class
C:\Tomcat\webapps\listenerTest\etc\web.xml

URL in browser:
http://localhost:8080/listenerTest/ListenTest.do

Result:

HTTP Status 404 - /listenerTest/ListenTest.do

type Status report
message /listenerTest/ListenTest.do
description The requested resource is not available.

Apache Tomcat/9.0.0.M9

In the "Tomcat Web Application Manager" it also shows:
Applications
/listenerTest
Running
true



 
Dave Tolls
Ranch Hand
Posts: 2091
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
C:\Tomcat\webapps\listenerTest\WEB-INF\classes

Looks like you are missing a folder.
And etc should be in there as well.
And I think web.xml should be directly in WEB-INF, not etc.
 
Arend van der Kolk
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dave,

You are so right. The folder mistake (missing WEB-INF) was just an redo error when redoing the whole folder set up again as a second attempt.

But the location of the web.xml was my crucial mistake. Its now all like below and working.

Correct location

C:\Tomcat\webapps\listenerTest\WEB-INF\classes\com\example\MyServletContextListener.class
C:\Tomcat\webapps\listenerTest\WEB-INF\classes\com\example\ListenerTester.class
C:\Tomcat\webapps\listenerTest\WEB-INF\classes\com\example\Dog.class

C:\Tomcat\webapps\listenerTest\WEB-INF\web.xml

Result:

http://localhost:8080/listenerTest/ListenTest.do

Test context attributes set by listener

Dog's breed is: Great Dane

Thanks a million for helping me out. After 2 hours i start staring at the screen, ;-)

cheers,

Arend
 
Arend van der Kolk
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The web.xml in the /etc folder is a copy/paste mistake from the development folder structure they make us use in the book.

Development folder structure: (NOT deployment)

C:\MyProjects\listenerTest\classes
C:\MyProjects\listenerTest\etc\web.xml
C:\MyProjects\listenerTest\lib
C:\MyProjects\listenerTest\src
C:\MyProjects\listenerTest\web
 
Dave Tolls
Ranch Hand
Posts: 2091
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's an odd structure.
I would have expected it to sit under maybe the web directory, under WEB-INF.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic