This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSP 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
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>
--------------------------------------------------------------------
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Post some the error message that you are getting.


My blood is tested +ve for Java.
kirtikumar patel
Greenhorn

Joined: Jun 29, 2005
Posts: 14
hi!
specify complete path in servlet-class tag in web.xml
and also check url is also written down correcly or not?

if then after u also have same error plz send me (kirti_engineer@rediffmail.com) your class file with web.xm and url those you wirte for access that page in browser


kirti patel<br />software engiener<br />pune
Suhani arora
Greenhorn

Joined: Jul 03, 2005
Posts: 8
I got the Solution Actually there is need to write each servlet and their URL mapping in web.xml and the way is that

<servlet>
<servlet-name>Login</servlet-name>
<servlet-class>User_Entry</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Login</servlet-name>
<url-pattern>/servlet/Login</url-pattern>
</servlet-mapping>
 
Don't get me started about those stupid light bulbs.
 
subject: 404 Exception