Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Running servlet in Tomcat

 
Leena Diwan
Ranch Hand
Posts: 351
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends,

I have problem running the servlet in Tomcat.

I have included servlet and servlet-mapping elements in the DD

Earlier I had not put the servlet in any package. I also tried putting the class file in a folder and giving it as its package name.

I created a webapps/trials dir and put all my stuff there.

Anyone knows what else can I check?

Im getting the famous
Apache Tomcat/4.0.1 - HTTP Status 404 - /trials/TestServlet error!

Regards,
leena
 
Leena Diwan
Ranch Hand
Posts: 351
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exact error is - 'The requested resource (/trials/TestServlet) is not available.'
 
Phani Kumar Sripada
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Leena,

Make sure the following are in place.

i) All the Servlet classes are under webapps/trials/WEB-INF/classes directory.
ii) The DD web.xml is in webapps/trials/WEB-INF directory.

Regards,
Phani.
 
kriti sharma
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Leena : me too same error on tomcat 5.0.19

Phani : i have everything in correct place as you have pointed,still the same error.
 
Ritesh Agrawal
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried the same and for me it works. I have done the following:

1. Coded the servlet class TestServlet.java (Didn't use any package).
2. Compiled and placed it in webapps/trial/WEB-INF/classes/ directory.
3. Made following entries into webapps/trial/WEB-INF/web.xml file



4. Started the Tomcat 5.0.19 application.
5. Entered the following URL http://localhost:8080/trial/TestServlet

and Bingo!!! It works.

I believe, in your case there would have been some problem with the web.xml entries. Usually that's the place where most people make mistakes.

Hope it helps.
 
Leena Diwan
Ranch Hand
Posts: 351
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was using tomcat 4.0 The problem was with the invoker servlet mapping in the conf/Web.xml file.

I have run the servlets with myApp/servlet/TestServlet URL instead of myApp/TestServlet

Regards,
Leena
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic