Win a copy of Head First Android this week in the Android 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

404 error when accessing servlet?

 
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 428
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 428
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic