• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem accessing servlet through Tomcat 5.0.28

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to set up tomcat on my dev. server. I am having trouble getting my servlets to work. I have tried to follow the directions for Tomcat 5 on its site, but they are kind of confusing. I also have a servlet book, but it talks about Tomcat 4. something. Is there a big difference between 4 and 5? Anyway, when I try to view a servlet, the server gives a HTTP 404 error, and says the resource is not available.

Here is what I have done:

1. linked apache and tomcat with mod_jk2. This is working fine for jsp
2. created dir. structure tomcat\webapps\myApp\WEB-INF\classes.
3. saved and compiled servlet to classes subdirectory.
4. created web.xml descriptor in web-inf directory.
5. access the servlet at http://localhost:8000/8080/myApp/servlet/Servlet
port 8000 is the tomcat port, and 8080 is the apache port

This gives the 404 error everytime I try to access the servlet.

I am able to access the admin and management part of tomcat so I know it is working, and my .jsp pages also work, just not the servlets.

Can anyone help???
Thanks
[ October 25, 2004: Message edited by: Adam Dear ]
 
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Adam,

Assuming you could see the Tomcat main page by accessing the http://localhost:8080. Did you uncomment the servlet and servlet-mapping elements in tomcat/conf/web.xml?

For more info, you can check out CoreServlets: 6. Enable the Invoker Servlet.

Joyce
[ October 25, 2004: Message edited by: Joyce Lee ]
 
Joyce Lee
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
5. access the servlet at http://localhost:8000/8080/myApp/servlet/Servlet

How about you try http://localhost:8000/myApp/servlet/ServletName? where ServletName is the servlet you wish to run.

Joyce
 
Adam Dear
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the suggestions. I finally got it to work by adding a <servlet-mapping> element to the application web.xml file.

thanks again!!!
 
reply
    Bookmark Topic Watch Topic
  • New Topic