Women in Technology

Hear us Roar



Article:
  Deploying Web Applications to Tomcat
Subject:   Solution on 404 Tomcat Server side error !!
Date:   2002-10-02 02:56:38
From:   anonymous2
Hi all, i don't know this is the only flaws that cause the 404 file not found error but it works for me.


Here is my web.xml
====================================
<?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>
</servlet>
<servlet-mapping>
<servlet-name>login</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>


</web-app>
==========================================
* you should noticed the addtion element "servlet-mapping"


By the way i modify the form action from
"servlet/com.onjava.login" to "servlet/login" as well.


i thinks it is because of the different version of tomcat.


I try and error for days, so i think i should post here for anyone who follows my step.


ALex
Hong Kong

Full Threads Newest First

Showing messages 1 through 2 of 2.

  • Another Solution
    2002-10-22 22:37:34  zowens [View]

    This is a great article, but I also had some trouble getting the example to work.

    I followed the exact steps in the article and was getting a 404 error when submitting the login.jsp form. I changed my web.xml file to the following:

    ==========================================
    <?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/j2ee/dtds/web-app_2_3.dtd">

    <web-app>
    <servlet>
    <servlet-name>mail</servlet-name>
    <servlet-class>mail</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>mail</servlet-name>
    <url-pattern>/mail</url-pattern>
    </servlet-mapping>
    </web-app>
    ==========================================

    This is assuming you have your .jsp pages in the root of the project directory “TOMCAT_ROOT/webapps/onjava/”. With this fix there is no need to change the action for the form.

    Alex, thanks for heading me in the right direction!

    Good Luck!
    Zach
    • Solution works with servlets, but what about javabeans?
      2003-01-12 10:44:24  qrobur [View]

      I was very happy when these two messages put me on the road to running this example web application in Tomcat 4.1.18.

      However, it is not a solution for my jsp pages that use javaBeans rather than servlets. This is the error I get:


      description: The server encountered an internal error () that prevented it from fulfilling this request.

      exception
      org.apache.jasper.JasperException: Cannot find any information on property 'uName' in a bean of type 'coreBeans.FormBean'
      etc.


      If anybody can throw some light on this aspect of the problem I would be grateful.

      Also, does anyone know why we are having to resort to mapping our servlets anyway?