• Post Reply Bookmark Topic Watch Topic
  • New Topic

HTTP 404 Error while Running Servlet Application

 
Jay Shukla
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don;t know the exact reason earlier topic was locked.
Hence, posting again.

I have (complied from FirstServlet.java) FirstServlet.class included in the package com.
My complied class is at following location.

apache-tomcat-6.0.16\webapps\Ch01\WEB-INF\classes\com\FirstServlet.class

I changed my web.xml as following:


<servlet>
<servlet-name>FirstServlet</servlet-name>
<servlet-class>com.FirstServlet</servlet-class>
</servlet>

And after that i tried to run it again with URL : http://localhost/Ch01/firstservlet eventhough same HTTP 404 status.

What could the problem now?

Thanks in Advance.
 
Hesham Abo El-Magd
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the <url-pattern> in the <servlet-mapping > at the web.xml is firstservlet ?!
also too try Restart the Tomcat and re-deploy the application !
 
Jay Shukla
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Hesham Thanks for the help.
<url-pattern> is /firstservlet.

Actually after compiling the class. I change <servlet-class> tag in the web.xml and after that i shutdown and startup the tomcat but getting the same 404 error.

Thanks.
 
Hesham Abo El-Magd
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is that the first time you run the tomcat at the your localhost ? what's the tomcat port number ? is it 8080 ?!
 
Jay Shukla
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Hashem I'm not sure about the port number.

But when i give URL http://localhost i'm getting Apache Software Foundation home page. So i think Port number is optional.
 
Hesham Abo El-Magd
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apache is not like apache tomcat. the default port for the apache tomcat is 8080 . it should be like this Localhost the default port for the apache is 80 which is the http default port so you don't have to type it but to the tomcat you have to type the :8080 besides the url link
the tomcat home page is like that ..
 
Hesham Abo El-Magd
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it didn't display the image ......here's the link for the image Apache Tomcat Home Page Screenshot
 
Ryan Beckett
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try: http://localhost:8080/Ch01/firstservlet
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!