• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem accessing servlet through Tomcat 5.0.28

 
Adam Dear
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • 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 ]
 
Joyce Lee
Ranch Hand
Posts: 1392
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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!!!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic