Results 1 to 6 of 6

Thread: 404 Not Found

  1. #1
    mary is offline Member
    Join Date
    Jul 2007
    Posts
    51
    Rep Power
    0

    Default 404 Not Found

    When I try to run the servlet the server return to me and exception
    I created servlet "HelloWorld" and saved it under webapps>ROOT>utils>WEB-INF>classes.
    I created the web.xml file to map it, and I saved it under webapps>ROOT>utils>WEB-INF.

    when I click http://localhost:8080/utils/hello to run servlet, appears:
    404 Not Found /utils/hello was not found on this server.

    what's the problem?

  2. #2
    henry_78 is offline Member
    Join Date
    Aug 2007
    Posts
    47
    Rep Power
    0

    Default

    Hi,
    It could be your web.xml file. U have to do the right mapping between the page and the .class file.
    Try to show us your web.xml please.
    Bye.

  3. #3
    mary is offline Member
    Join Date
    Jul 2007
    Posts
    51
    Rep Power
    0

    Default

    I created the web.xml file to map it, the web.xml look likes below and saved it under webapps>ROOT>utils>WEB-INF.
    Java Code:
    <web-app xmlns="http://sor.com/ns/resin">
    <servlet servlet-name="hello"
    servlet-class="Hello"/>
    
    <servlet-mapping url-pattern="/hello"
    servlet-name="hello"/>
    </web-app>

  4. #4
    goodguy052 is offline Member
    Join Date
    Nov 2007
    Posts
    2
    Rep Power
    0

    Default

    take the utils directory from root and place it under webapps directory. so, now new path is tomcat>webapps>utlis>WEB-INF>
    make new dir classes under WEB-INF and place the class Hello in classes.

    make web.xml as follows and place it under WEB-INF:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">
    <servlet>
    <servlet-name>hello</servlet-name>
    <servlet-class>Hello</servlet-class>
    </servlet>

    <servlet-mapping>
    <servlet-name>hello</servlet-name>
    <url-pattern>/hello</url-pattern>
    </servlet-mapping>

    </web-app>

    This will work

    and type the following url in browsers address bar:
    http://localhost:8080/utils/hello
    to run servlet
    Last edited by goodguy052; 11-05-2007 at 08:14 PM. Reason: forgot to add some more info

  5. #5
    kavitanikam is offline Member
    Join Date
    Nov 2007
    Posts
    2
    Rep Power
    0

    Default

    better way u can use this structure
    In webapps create MyApps in that create WEB-INF in this u can copy that web.xml file.
    In WEB-INF create classes folder.

  6. #6
    bar311 is offline Member
    Join Date
    Nov 2007
    Posts
    7
    Rep Power
    0

Similar Threads

  1. Class not found Exception
    By surendra in forum Java Servlet
    Replies: 8
    Last Post: 06-09-2011, 01:52 PM
  2. struts No Collection Found
    By orchid in forum Web Frameworks
    Replies: 3
    Last Post: 02-18-2010, 06:37 PM
  3. could not be found in the registry
    By alam99 in forum Eclipse
    Replies: 0
    Last Post: 01-08-2008, 09:21 AM
  4. ConnectException not found
    By tamayo in forum New To Java
    Replies: 1
    Last Post: 07-23-2007, 09:23 AM
  5. Hibernate table not found
    By orchid in forum JDBC
    Replies: 2
    Last Post: 05-06-2007, 08:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •