Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problems with deploying servlet

 
Hari priya
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Preetham Chandrasekhar
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Hari priya
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Preetham-
I tried that too. But it is still not working!!
 
Preetham Chandrasekhar
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13061
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the invoker servlet FAQ here at the ranch.
Plus an incredible number of similar conversations in the last 2 weeks.
Bill
 
Hari priya
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi -

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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic