Forums Register Login

simple problem

+Pie Number of slices to send: Send
Hello Friends,

As i am not a beginner programmer having months of experience in coding i am facing a ver simple problem which i cant able to rectify.

i am using tomcat 5.0 i wrote a beginner HelloServlet like this

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class HelloServlet extends HttpServlet {

public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {

resp.setContentType("text/html");
PrintWriter out = resp.getWriter();

out.println("<HTML>");
out.println("<HEAD><TITLE>Have you seen this before?</TITLE></HEAD>");
out.println("<BODY><H1>Hello, World!</H1><H6>Again.</H6></BODY></HTML>");
}
}

placed in "tomcat5.0\webapps\root\web-inf\classes" and complied there itself

i am running like this
http://localhost:8080/servlet/HelloServlet

getting this error

HTTP Status 404 - /servlet/HelloServlet
type Status report
message /servlet/HelloServlet
description The requested resource (/servlet/HelloServlet) is not available.
Apache Tomcat/5.0.28

nore i restarted my tomcat server and also verified

what is this please help me
+Pie Number of slices to send: Send
forgot to add this

i am not using any IDE pls.
just notepad
i am trying this for a sample application

bye
+Pie Number of slices to send: Send
Probably posting the web.xml would be a nice idea.
+Pie Number of slices to send: Send
Hi anupam,

using web.xml is nice idea and we have to do like that for a good practice.

But just i want to know what is happening whats the mistake i done is this o done anything wrong.

pls help with your ideas...
bye
+Pie Number of slices to send: Send
From the looks of the URL that you're using to try to access your servlet, I'd guess that you're using a slightly out of date book or tutorial.

In the past, you could call servlets this way via the InvokerServlet.
That has been commented out of the Tomcat config scripts for the last few years. Your servlet will need to be mapped in your deployment descriptore (web.xml).

For more information, see:
http://faq.javaranch.com/view?InvokerServlet
+Pie Number of slices to send: Send
You are trying to use the InvokerServlet, which is why you can call the servlet without configuring it in web.xml, but the InvokerServlet is not enabled by default, you would have to configure Tomcat to allow this first.

Much better to configure the servlet correctly and not use the Ivoker, it is not a good thing to use.

Dave
+Pie Number of slices to send: Send
 

Originally posted by Sunesh Kumar:
Hi anupam,

using web.xml is nice idea and we have to do like that for a good practice.

But just i want to know what is happening whats the mistake i done is this o done anything wrong.



The mistake is that you're trying to use a feature that is no longer present.
The explicit mapping of servlets is no longer just a best practice. It's "how servlets are deployed".
+Pie Number of slices to send: Send
Hello Ben,

Thanks Ben . I dont know it has been eliminated just i saw the Url from the core servlets and JSP by Marty Hall and Blary Brown

Ok thanks to inform that this way is eliminated.
can u suggest any latest tutorial on the web for the JSP and servlets.

bye ...
+Pie Number of slices to send: Send
Hi,

Visit the following URL, It has some ebook for jsp & servlets.
Ebook needs registration but free

bye for now
sat
+Pie Number of slices to send: Send
Hey Satish,

its not working my dear friend. Could you please send me again the URL i am curious to learn perfectly jsp and servlets.

Bye..
+Pie Number of slices to send: Send
I believe "Core Servlets" has been updated and is in it's 2nd Edition now.

If you want a simple "Hello, World" servlet example, there is one on my site.
http://simple.souther.us
+Pie Number of slices to send: Send
Hello Ben...


Sorry for late response...

I am very much thankful to you for your site which had examples. i am very pleased to see this site.

and the link "http://faq.javaranch.com/view?InvokerServlet" is simply excellent Ben, thanks for this.

Another thing just i want to notify that
i am using

CoreServlets and JavaServerPages
Volume 1:Coretechnologies
Second Edition
only

in this book only i saw that urls any way thanks for notifying me..But i am suffereing with another problem as this book is not updated in future i may get any errors like this...pls can u guide me

Waiting for ur reply "Ben"...
+Pie Number of slices to send: Send
Sunesh, when that version of core servlets book was written the examples used a previous version of tomcat. You eithr need to access the servlets as the previous posted have mentioned, get a more updated book, or just download the version of tomcat that book recommended, which I believe is version 3.1 or so.

BTW, that is a very good bok to learn from too.
+Pie Number of slices to send: Send
Hi sunesh,
Go thru this link...
Me to face teh same issue ..Its resolved now by following the idea int eh forum...

http://forum.java.sun.com/thread.jspa?threadID=720685
+Pie Number of slices to send: Send
Hi Sunesh
can u gimme ur mail id such that i can send u a sample to code...
+Pie Number of slices to send: Send
Hi Udhan,

Thanks for help yaar. my id is

suneshkumar@gmail.com

waiting for ur reply ...
It's a tiny ad. At least, that's what she said.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 922 times.
Similar Threads
help needeed....
Error 404: File not found: loadservlet
getting error while running servlet in tomcat
Need help
HTTP status 404 error from Tomcat
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 02:37:33.