This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Servlets and the fly likes 404 error when accessing servlet? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "404 error when accessing servlet?" Watch "404 error when accessing servlet?" New topic

404 error when accessing servlet?

M Burke
Ranch Hand

Joined: Jun 25, 2004
Posts: 397
I have a jsp that calls a servlet. But when I click submit I get a 404 error from Tomcat 4.1. What am I missing?

<form action="servlet/easyRatesPkg.EasyRates" method="post">

JSP: C:\Tomcat 4.1\webapps\EasyRatesJava\outputPanel.jsp
Servlet: C:\Tomcat 4.1\webapps\EasyRatesJava\WEB-INF\classes\easyRatesPkg\EasyRates.class
Anthony Watson
Ranch Hand

Joined: Sep 25, 2003
Posts: 327
Don't use the invoker servlet. Define the servlet and a servlet-mapping in your web.xml file and don't preface your servlet with 'servlet' in the url.
M Burke
Ranch Hand

Joined: Jun 25, 2004
Posts: 397
Well, even when I try to invoke the servlet directly, I still get a 404. There seems to be something deeper wrong.

The .class file exists in the WEB-INF/classes/easyRatesPkg dir, but this will not work

Is there something about Tomcat that needs to be set up?
[ August 24, 2004: Message edited by: M Burke ]
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13027

Is using the "invoker" servlet syntax - thats what Anthony was trying to call your attention to. See the invoker FAQ here at the Ranch.
M Burke
Ranch Hand

Joined: Jun 25, 2004
Posts: 397
OK, I uderstand. I added this...


and changed the form to this...

<form action="EasyRates" method="post">

I was confused because all the examples I have invoke like this \servlet\servname
I agree. Here's the link:
subject: 404 error when accessing servlet?
It's not a secret anymore!