File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Servlet call error: 404 servlet call not available Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet call error: 404 servlet call not available" Watch "Servlet call error: 404 servlet call not available" New topic
Author

Servlet call error: 404 servlet call not available

Abhijeet Garde
Greenhorn

Joined: Jan 21, 2006
Posts: 1
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.
James Zhu
Greenhorn

Joined: Jan 21, 2006
Posts: 4
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
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12682
    
    5
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


Java Resources at www.wbrogden.com
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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>


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet call error: 404 servlet call not available
 
Similar Threads
Deploying My WebApp in Tomcat
JSP not able to find the servlet
Head First Servlet JSP: BeerSelect example: requested resource not available
Calling a servlet from a html page
Help Me