wood burning stoves*
The moose likes Servlets and the fly likes 404 Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "404 Exception" Watch "404 Exception" New topic
Author

404 Exception

Suhani arora
Greenhorn

Joined: Jul 03, 2005
Posts: 8
Hi to All.....
Frnds I am creating WEB application in which i am using JSP,Servlet,Bean-Class. I have developed it in Tomcat 4.1.10 but due to some reason it is corrupt and now i have installed Tomcat 4.1.31 .After installed i am facing new problem my servlet is not called .It shows 404 Exception servlet not found .any one please tell me why is this happening .I have checked the spelling and Servlet there is not problem.

My WEB.XML is
---------------------------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
<servlet>
<servlet-name>login</servlet-name>
<servlet-class>loginServlet</servlet-class>
<servlet-mapping>
<servlet-name>login</servlet-name>
<url-pattern>servlet/*</url-pattern>
</servlet-mapping>
</servlet>

<security-constraint>
<display-name>Security Constraint</display-name>
<web-resource-collection>
<web-resource-name>USER</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>DELETE</http-method>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
</web-resource-collection>

<auth-constraint>
<role-name>usr</role-name>
<role-name>adm</role-name>
</auth-constraint>

<user-data-constraint><transport-guarantee>NONE</transport-guarantee></user-data-constraint>
</security-constraint>

<login-config>
<auth-method>FORM</auth-method>
<realm-name>Form-Based Authentication</realm-name>
<form-login-config>
<form-login-page>/index.jsp</form-login-page>
<form-error-page>/Error.jsp</form-error-page>
</form-login-config>
</login-config>

<security-role>
<description>Administrator </description>
<role-name>adm</role-name>
</security-role>

<resource-ref>
<description>Connection</description>
<res-ref-name>jdbc/connection</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

</web-app>
--------------------------------------------------------------------
Shrinivas Mujumdar
Ranch Hand

Joined: Aug 27, 2004
Posts: 328
In your code there is a line in web.xml

<url-pattern>servlet/*</url-pattern>

In tomcat 4.1 you must specify (/)in url pattern. In short the above line should change to
<url-pattern>/servlet/*</url-pattern>
it will work definitely.

regards
Shrinivas Mujumdar
Shrinivas Mujumdar
Ranch Hand

Joined: Aug 27, 2004
Posts: 328
In your code there is a line in web.xml

<url-pattern>servlet/*</url-pattern>

In tomcat 4.1 you must specify (/)in url pattern. In short the above line should change to
<url-pattern>/servlet/*</url-pattern>
it will work definitely.

regards
Shrinivas Mujumdar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: 404 Exception
 
Similar Threads
web.xml hard work
form based login with LDAP
Web.xml
404 Exception
ELEMENT init-param(param-name, param-value, description?