Hi all - I am new to the servlet technology. I am trying to deploy my servlet. for this purpose, I am using tomcat 5 on windows XP. I have place my LuckyNumberServlet1 class file in servlets-examples/web-inf/classes and modified my web.xml to <servlet> <servet-name>LuckyNumberServlet1</servlet-name> <servlet-class>LuckyNumberServlet1</servlet-class> </servlet> <servlet-mapping> <servlet-name>LuckyNumberServlet1<servlet-name> <url-pattern>/servlet/LuckyNumberServlet1</url-pattern> </servlet-mapping> and I am trying to access it by http://localhost:8080/servlets-examples/servlet/LuckyNumberServlet1 but I am getting an error HTTP Status 404 - /servlets-examples/servlet/LuckyNumberServlet1 I have tried various ways but I still end up getting the same error. Can some one please let me know where I am doing wrong? Thanks in advance Radha
ok.... im kinda new too..lemme try to help you.... servlet-mapping> <servlet-name>LuckyNumberServlet1<servlet-name> <url-pattern>/servlet/LuckyNumberServlet1</url-pattern> </servlet-mapping> try changing the following: http://localhost:8080/servlet/LuckyNumberServlet1 since u have given your url-pattern as /servlet/LuckyNumberServlet1 jus add this...as shown above...
My question to all members is.....say if u r planning to deploy a servlet, should you go and specify the servlet name and class in the web-xml? coz i didnt have to and it still worked when i deployed it. When do you modify the web-xml and when would u not?
"In theory, there is no difference between theory and practice. But, in practice, there is."<br /> - Jan L.A. van de Snepscheut
Joined: Mar 11, 2004
Hi Preetham- I tried that too. But it is still not working!!
Joined: Nov 05, 2003
hmmm.... are u running the tomcat from command line.....what is the error its giving in the command line? does it say class file missing or something? check it out...it would get u close to the err.
Verify that the invoker servlet is not disabled in Tomcat. You may also want to put your classes in a package and then create a webapp to hold your files. It just makes things a whole lot easier. [ April 16, 2004: Message edited by: Bosun Bello ]
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
I have tried uncommenting the invoker servlet but it doesn't work. The worst part is, I have commented it back and still doesn't work. I could not even load the other examples (in the servlets-examples folder) which otherwise used to work normally.
Please let me know anything that I should do. I don't think I was mishandling my web.xml 's.
Thanks. [ June 12, 2007: Message edited by: Hari priya ]