| Author |
http status 404 message {extremely urgent help required}
|
mazoun yusuf
Greenhorn
Joined: Feb 11, 2005
Posts: 19
|
|
I get the following error. Could somebody please help. Apache Tomcat/5.03 - HTTP Status 404 - / type Status report message / description The requested resource (/) is not available i have put the following classes(ServerReq.class,DisplayTasks.class,SendMsg.class) in WEB-APPS\ROOT\WEB-INF\classes the following has been added to the web.xml file <!-- JSPC servlet mappings start --> <servlet> <servlet-name>org.apache.jsp.index_jsp</servlet-name> <servlet-class>org.apache.jsp.index_jsp</servlet-class> </servlet> <servlet> <servlet-name>ServerReq</servlet-name> <servlet-class>ServerReq/servlet-class> </servlet> <servlet> <servlet-name>DisplayTasks</servlet-name> <servlet-class>DisplayTasks</servlet-class> </servlet> <servlet> <servlet-name>SendMsg</servlet-name> <servlet-class>SendMsg</servlet-class> </servlet> <servlet-mapping> <servlet-name>org.apache.jsp.index_jsp</servlet-name> <url-pattern>/index.jsp</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>ServerReq</servlet-name> <url-pattern>/lab/ServerReq</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>DisplayTasks</servlet-name> <url-pattern>/lab/DisplayTasks</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>SendMsg</servlet-name> <url-pattern>/lab/SendMsg</url-pattern> </servlet-mapping> <!-- JSPC servlet mappings end --> [ February 13, 2005: Message edited by: mazoun yusuf ]
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
|
What URL are you using to try to access your servlet?
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
mazoun yusuf
Greenhorn
Joined: Feb 11, 2005
Posts: 19
|
|
|
http://localhost:8080/lab/ServerReq
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
<url-pattern>/lab/ServerReq</url-pattern> Don't list the context name in your mapping. It should be: <url-pattern>/ServerReq</url-pattern>
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
|
Also, package your classes. Even if you get this working, you're going to run into problems down the road if you don't.
|
 |
mazoun yusuf
Greenhorn
Joined: Feb 11, 2005
Posts: 19
|
|
I FORGOT to mention that the folder lab is in the folder classes. thats why i have inserted /lab inthe url
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
mazoun, An example might help. Go to http://simple.souther.us, download and run SimpleServlet according to the instructions up there (should take between 3 and 5 mouse clicks if you already have Tomcat running) You will then have a working example of a helloWorld servlet that is properly packaged and mapped. The directory structure under the classes directory needs to match your package declaration in the servlet or bean. It also has to match the listing in your servlet-class tag under the servlet tag. You don't need to mention it in the URL Pattern. Try the example and let me know how it works out for you. [ February 13, 2005: Message edited by: Ben Souther ]
|
 |
mazoun yusuf
Greenhorn
Joined: Feb 11, 2005
Posts: 19
|
|
i have downloaded the required stuff.do i have to unzip it .what do i have to do to the class file plz help i am getting xtremely confused
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
You don't need to do anything with it. Make sure your browser didn't add a '.zip' extension to it. It should be named 'SimpleServlet.war'. Then just put it in your webapps directory. Tomcat will do all the rest.
|
 |
mazoun yusuf
Greenhorn
Joined: Feb 11, 2005
Posts: 19
|
|
u were right.it became a .zip ext. how to make it a .rar file plz help plzhelp plz help
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
|
right click on the file and select 'rename'.
|
 |
mazoun yusuf
Greenhorn
Joined: Feb 11, 2005
Posts: 19
|
|
HTTP Status 404 - /SimpleServlet/simple-servlet -------------------------------------------------------------------------------- type Status report message /SimpleServlet/simple-servlet description The requested resource (/SimpleServlet/simple-servlet) is not available thats the error i am obtaining
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Look in the webapps directory of Tocmat. Did Tomcat unzip the war file for you? If so, you should have a SimpleServlet directory as well as the SimpleServlet.war file.
|
 |
mazoun yusuf
Greenhorn
Joined: Feb 11, 2005
Posts: 19
|
|
no it didnt unzip anything i think the problem may be due to the download i have made.it was a .zip file and i have renamed i a .war file. is it ok the way i have done it sorry for the pain
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Are you sure that the file has only a '.war' extension? Windows sometimes hides extensions for know file types. It may be showing you 'SimpleServlet.war' but really storing it as 'SimpleServlet.war.zip'. Try downloading again. This time, in the "Save as section:" instead of using the default (Compressed Zip file), choose 'All Files'. [ February 13, 2005: Message edited by: Ben Souther ]
|
 |
mazoun yusuf
Greenhorn
Joined: Feb 11, 2005
Posts: 19
|
|
thanks dude i obtained hello, world on the browser. can i make my class files as yr example and run it
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Congrats! It was a long battle but you won. Yea, that's why the examples are there (you'll probably want to get my name out of the package string though ). One question, and I'm not trying to be a wise-ass: How did getting this going for you get to become "extremely urgent"?
|
 |
mazoun yusuf
Greenhorn
Joined: Feb 11, 2005
Posts: 19
|
|
coz i have to submit an assignment tomorrow thanks a lot i am trying to run a servlet can i continue posting on the forum if i have ay problem or send u a private message if am not disturbing u u r a genius  [ February 13, 2005: Message edited by: mazoun yusuf ]
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
coz i have to submit an assignment tomorrow Ok. Warning: That has a tendency to back-fire. A lot of developers will refuse to even read a post with 'urgent' in the subject line. You'll get better responses if you use only a subject that describes the problem. i am trying to run a servlet can i continue posting on the forum if i have ay problem or send u a private message if am not disturbing u You can but I may not get a chance to answer right away. The Servlet and JSP forums are packed with competent people who are anxious to help though. When I find answering questions disturbing, I'll simply, stop. Good-Luck with your assignment. [ February 13, 2005: Message edited by: Ben Souther ]
|
 |
mazoun yusuf
Greenhorn
Joined: Feb 11, 2005
Posts: 19
|
|
i have edited the web.xml as follows: <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 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> <display-name>Servlet for the Server</display-name> <description> Server </description> <display-name>Display App</display-name> <description> Display App </description> <display-name>Message Sending</display-name> <description> Send Messages </description> <servlet> <servlet-name>ServerReq</servlet-name> <servlet-class>maz.preet.pro.final.ServerReq</servlet-class> </servlet> <servlet> <servlet-name>DisplayTasks</servlet-name> <servlet-class>maz.preet.pro.final.DisplayTasks</servlet-class> </servlet> <servlet> <servlet-name>SendMsg</servlet-name> <servlet-class>maz.preet.pro.final.SendMsg</servlet-class> </servlet <servlet-mapping> <servlet-name>ServerReq</servlet-name> <url-pattern>/ServerReq</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>DisplayTasks</servlet-name> <url-pattern>/DisplayTasks</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>SendMsg</servlet-name> <url-pattern>/SendMsg</url-pattern> </servlet-mapping> </web-app> r these correct?
|
 |
 |
|
|
subject: http status 404 message {extremely urgent help required}
|
|
|