Women in Technology

Hear us Roar



Article:
  Java Web Applications
Subject:   error 404- servlet would not load
Date:   2002-11-18 12:37:46
From:   anonymous2
I just want to share this with anyone having this problem.


Despite setting the server.xml netry for the context and, having the correct directory structure, the servlet login wouldn't load and kept giving a 404 error.


I managed to get it right by setting the web.xml file this way :


<?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>
com.onjava.login
</servlet-class>
<load-on-startup>
1
</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>
login
</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
</web-app>


I don't know if this makes any sense, but the node <url-pattern> did it and it works now.

Main Topics Newest First

Showing messages 1 through 1 of 1.

  • error 404- servlet would not load
    2003-07-14 04:40:52  anonymous2 [View]

    I have my project folder and i have made modification in my server.xml i have added

    context path


    in the web.xml in the webapps /web-inf folder i am doing the servlet mapping.. but it is taking the file from the root only


    <web-app>

    <display-name>Application </display-name>
    <session-timeout>30</session-timeout>

    <servlet>
    <servlet-name>LoginServlet</servlet-name>
    <servlet-class>com.project.LoginServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
    <servlet-name>LoginServlet</servlet-name>
    <url-pattern>project/servlet/*</url-pattern>
    </servlet-mapping>

    </web-app>

    what is the solution ?..plz write back soon

    vijay_shah_78@rediffmail.com