• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Servlet call error: 404 servlet call not available

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi guys,

i have a question relating to servlet call.
I am using tomcat for my server.
I am calling a servlet from a html form action
as follows -

<form method="get" action="/myapplication/MyServlet">
<Input types -- >
<-- different input types here--->
< --------->

<input type="submit">
</form>


where myapplication is the name of my folder kept in webapps of Tomcat.

My servlet is kept in WEB-INF/classes, I have not used any package to keep the servlet in, it is directly inside classes.
My deployment discriptor ie web.xml is kept in WEB-INF.

the url mapping is -

<servlet-name>MyServlet</servlet-name>
<servlet-class>MyServlet</servlet-class>


<url-pattern>MyServlet</url-pattern>


but still when I press submit on my html page it gives 404 error and says /myapplication/MyServlet is not available.

please help.

Thanks in advance.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please check the DOCBASE property of your application in the file of server.xml which is available in YOUR_TOMCAT_FOLDER/conf.
Without that the server can not find your application.

good luck (- -)V
 
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

I have not used any package to keep the servlet in,


Experience suggests that this is a bad idea. Just do that little bit of extra effort, put ALL classes used with servlets in a package, and avoid many mysterious bugs.
Bill
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I assume these are exerpts from your deployment descrptor and that you've
got full <servlet> and <servlet-mapping> entries.



Try changing
<url-pattern>MyServlet</url-pattern>
to
<url-pattern>/MyServlet</url-pattern>
 
Oh, sure, you could do that. Or you could eat some pie. While reading this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic