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

Error 404 while requesting for a page

 
Manju Devarla
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am getting request resource not avialbe when i access the servlet class which is alredy present in correct path as page30-31 in HeadFirst jsp&servlets..

Created the correct directory structure under webapps/ch1 : WEB_INF and classes put web.xml and class file correctly..(Evn checked log file nothing is mentioned)

able to access servlet-examples ans jsp-examples but not the below one

http://localhost:8080/ch1/Serv1

Can anyone help me out in solving this..
 
Elan Ram
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

correct the WEB_INF directory name to WEB-INF, and try again.
 
Manju Devarla
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry ie my typing mistake..its WEB-INF directory only
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please post the code fpr web.xml
and also the directory structure of your webapp
 
S Kapoor
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you implemented the doGet in the servlet?
 
Manju Devarla
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Niranjan,

This is my web.xml code :
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2.4.xsd"
version="2.4">

<servlet>
<servlet-name>Chapter1 Servlet</servlet-name>
<servlet-class>Ch1Servlet</servlet-class>
</servlet>

<servlet-mappling>
<servlet-name>Chapter1 Servlet</servlet-name>
<url-pattern>/Serv1</url-pattern>
</servlet-mappling>
</web-app>

yes implemeted doGet() method and have class file in the directory given below :

C:\Program Files\apache-tomcat-5.5.20\webapps\ch1\WEB-INF\web.xml
C:\Program Files\apache-tomcat-5.5.20\webapps\ch1\WEB-INF\classes\Ch1Servlet.class

and accessing thorugh URL - http://localhost:8080/ch1/Serv1 : displaying error message request/resource not avialable
 
S Kapoor
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure if you cut/paste the web.xml, but if you have, the element name should be <servlet-mapping> not <servlet-mappling>
 
Manju Devarla
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you verymuch kapoor ie the error..i chnaged to mapping and its working fine..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic