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

    Join Date
    May 2003
    Rep Power

    Unhappy Servlet activation in sum one app server

    I deployed my web app using sun one app server.

    I can access my app at :

    The main.html has 3 frames, in which in the top frame (top.html) I'm calling my only servlet (getxml):

    <base target="contents">
    <form METHOD="get" ACTION="/servlet/getxml">
    <INPUT TYPE=submit name=submit Value="call getxml servlet">

    But it does not work (sometimes I get 404 error and sometimes it just hangs for a long time...)
    The same happens when I call the servlet directly (http://localhost/webapps-xmltreeview/servlet/getxml).

    My web.xml is:
    <?xml version="1.0" encoding="UTF-8"?>

    <!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 'http://java.sun.com/j2ee/dtds/web-app_2_2.dtd'>


    The jakarta-tomcat-4.0.3 sample XMT treeview app.






    The servlet class exist in:
    Directory of C:\Sun\AppServer7\domains\domain1\server1\applications\j2ee-modules\webapps-xmltreeview_1\WEB-INF\classes\samples\webapps\xmltreeview\servlet

    05-08-03 08:52a <DIR> .
    05-08-03 08:52a <DIR> ..
    05-08-03 08:52a 1,072 getxml.class
    (See attched image)
    and was packaged as:
    package samples.webapps.xmltreeview.servlet;

    What am i doing worng
  2. #2
  3. No Profile Picture
    Clueless llama
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Feb 2001
    Lincoln, NE. USA
    Rep Power
    You have a couple of things going on. First of all, there are two ways to call a servlet from tomcat:
    [list=1][*]use the host/webapp/servlet/package.servletclassname convention[*]or map the servlet and call it using host/webapp/servletName[/list=1]

    So, using the first method your link would look like this (Note: I put spaces after the http so the message board would not try to make a link out of it):
    http: //localhost/webapps-xmltreeview/servlet/samples.webapps.xmltreeview.servlet.getxml

    And since you have a servlet mapping in your web.xml, you could call it like this
    http: //localhost/webapps-xmltreeview/getxml

    Now secondly, lets examine your forms action. You ahve
    <form METHOD="get" ACTION="/servlet/getxml">
    This makes the browser create a link like this
    http: //localhost/servlet/getxml

    This is clearly not what you want. Given the first point I made, you have two choices for correcting this:
    <form METHOD="get" ACTION="/webapps-xmltreeview/getxml">
    <form METHOD="get" ACTION="/webapps-xmltreeview/servlet/samples.webapps.xmltreeview.servlet.getxml">
    Hope that made sense.
    Last edited by Nemi; May 9th, 2003 at 11:51 AM.

IMN logo majestic logo threadwatch logo seochat tools logo