#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2002
    Posts
    7
    Rep Power
    0

    problem building a web application in tomcat 4.1.18


    Hi..
    I am trying to develop application called FirstApp. It has one servlet and one html file. The html file is called FirstApp.html and the servlet file is FirstApp.java
    I have Windows XP and Tomcat 4.1.18

    I create the following directories in webapps directory

    webapps/FirstApp - The html file is placed here
    webapps/WEB-INF - the web.xml is placed here
    webapps/WEB-INF/classes - the FirstApp.class file is placed in here

    The web.xml file is as follows.

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web
    Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app>
    <servlet>
    <servlet-name>FirstApp</servlet-name>
    <servlet-class>FirstApp</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>FirstApp</servlet-name>
    <url-pattern>/FirstApp<url-pattern>
    </servlet-mapping>
    </web-app>


    THE conf/server.xml file is also modified and only the following lines are added to the original file

    <Context path="/FirstApp" docBase="webapps/FirstApp" debug="0"
    reloadable="true" crossContext="true">
    </Context>

    The server starts properly after this..
    but I am not able to see even the HTML file ..

    I use

    http://localhost:8080/FirstApp/FirstApp.html

    neither the servlet

    I use

    http://localhost:8080/FirstApp/servlet/FirstApp

    I get HTTP STATUS 404 error, resource not available... error..

    What can be wrong ??

    Thanks
  2. #2
  3. No Profile Picture
    Moderator =(8^(|)
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2002
    Location
    Sacramento, CA
    Posts
    1,710
    Rep Power
    14
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    4
    Rep Power
    0
    You can also get that error if your port is already being used, ie ZoneAlarm can already used 8080. So you can change the port number in server.xml if needed...
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    1
    Rep Power
    0

    Talking


    Hey,

    I'm experimenting with Tomcat 4.1.12, and like you I have been experiencing problems loading servlets created in my own webapp.

    I searched the archive and came across a thread, which provided information that fixed my problem&mdash;the solution is at the bottom of the thread.

    I hope this helps. It sure saved me from yet another bout of hair-pulling, unbelievable frustration, and screaming at the monitor.
    --
    Russ
  8. #5
  9. No Profile Picture
    Clueless llama
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Feb 2001
    Location
    Lincoln, NE. USA
    Posts
    2,353
    Rep Power
    117
    WEB-INF goes in the FirstApp directory, not on the same level as it.

    webapps/FirstApp/WEB-INF/classes

    All web content goes in the FirstApp dir and any subDirs you want to make. WEB-INF, though it is technically in the web root, is protected by the servletEngine and cannot be accessed from the browser.
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    1
    Rep Power
    0
    try to change

    <Context path="/FirstApp" docBase="webapps/FirstApp" debug="0"
    reloadable="true" crossContext="true">
    </Context>


    to


    <Context path="/FirstApp" docBase="FirstApp" debug="0"
    reloadable="true" crossContext="true">
    </Context>

IMN logo majestic logo threadwatch logo seochat tools logo