Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Running servlet in Tomcat

 
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.'
 
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.
 
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.
 
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
 
crispy bacon. crispy tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic