aspose file tools*
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 Spring in Action 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
Author

404 error when accessing servlet?

M Burke
Ranch Hand

Joined: Jun 25, 2004
Posts: 388
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">

directory...
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: 388
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
http://localhost:8080/EasyRatesJava/servlet/easyRatesPkg.EasyRates

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
Rancher

Joined: Mar 22, 2000
Posts: 12806
    
    5
http://localhost:8080/EasyRatesJava/servlet/easyRatesPkg.EasyRates

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

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

<servlet-mapping>
<servlet-name>EasyRates</servlet-name>
<url-pattern>/EasyRates</url-pattern>
</servlet-mapping>

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: http://aspose.com/file-tools
 
subject: 404 error when accessing servlet?