advertisement

Article:
  Java Web Applications
Subject:   HTTP Status 404 - /onjava/servlet/com.onjava.login
Date:   2007-06-07 01:22:54
From:   DhirajShetty
Hi ,
On running the tutorials on my machine i get the following HTTP error after submitting the login.jsp page . I fail to realise as to where does it contain the pathname folder servlet .
My Web/xml entry is as follows:


<?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>
<display-name>The OnJava App</display-name>
<session-timeout>30</session-timeout>
<servlet>
<servlet-name>login</servlet-name>
<servlet-class>com.onjava.login</servlet-class>
<load-on-startup>1</load-on-startup>
<init-param>
<param-name></param-name>
<param-value></param-value>
</init-param>
</servlet>
</web-app>


Any guidance in this regards will be highly appreciated .


********************ERROR **********************


HTTP Status 404 - /onjava/servlet/com.onjava.login


type Status report


message /onjava/servlet/com.onjava.login


description The requested resource (/onjava/servlet/com.onjava.login) is not available.
Apache Tomcat/5.5.23

Full Threads Oldest First

Showing messages 1 through 6 of 6.

  • HTTP Status 404 - /onjava/servlet/com.onjava.login
    2008-02-10 19:13:18  pakornss [Reply | View]

    I use Metro 1.0, i forgot install Metro with "wsit-on-tomcat.xml" script

    WepApp Error like this:
    FAIL - Application at context path /fromjava could not be started
    • http://localhost:9090/saiapp/HelloWorldExample
      2008-03-04 16:43:45  my email [Reply | View]

      HTTP Status 404 - /saiapp/HelloWorldExample

      --------------------------------------------------------------------------------

      type Status report

      message /saiapp/HelloWorldExample

      description The requested resource (/saiapp/HelloWorldExample) is not available.


      --------------------------------------------------------------------------------

      Apache Tomcat/6.0.13
  • HTTP Status 404 - /onjava/servlet/com.onjava.login
    2007-07-23 12:42:56  RaviKA [Reply | View]

    Add the below servlet mapping to your web.xml. The servlet mapping should be given under the servlet. And the example should work.

    <servlet-mapping>
    <servlet-name>login</servlet-name>
    <url-pattern>/servlet/com.onjava.login</url-pattern>
    </servlet-mapping>
  • HTTP Status 404 - /onjava/servlet/com.onjava.login
    2007-07-23 12:41:20  RaviKA [Reply | View]

    Add the servlet mapping to your web.xml. And the example should work.
    • HTTP Status 404 - /onjava/servlet/com.onjava.login
      2007-09-25 03:00:06  vikaschablani [Reply | View]

      Below is the complete correct web.xml.
      Do not forget <web-app> tag.
      Restart the server.

      The meaning of this is that in our login.jsp we have written action=servlet/com.onjava.login.
      This same string "servlet/com.onjava.login" has to appear in web.xml in url-pattern. You can write any string but has to be same in jsp and in xml e.g. you can have string "Good", no problem.

      The string between <servlet-mapping> and between
      <servlet-name> has to be same, here it is login.
      Then finally :) the string between <servlet-class> is the actual class part for your FILE login.class i.e. com.onjava.login. :)
      web.xml->
      -----------------------------------
      <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/com.onjava.login</url-pattern>
      </servlet-mapping>

      </web-app>
      -------------------------------------
      • HTTP Status 404 - /onjava/servlet/com.onjava.login
        2007-09-25 04:14:45  vikaschablani [Reply | View]

        One correction. In url patern there is a forward slash prefixed before the string. So if in jsp string was: action="servlet/com.onjava.login", in xml it will be
        <url-pattern>/servlet/com.onjava.login</url-pattern>

        web.xml->
        -----------------------------------
        <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/com.onjava.login</url-pattern>
        </servlet-mapping>

        </web-app>
        -------------------------------------