Are you absolutely sure the problem is with CensusQuery and not a referenced
class?  It could be that Tomcat can't find another class that is referenced
by CensusQuery, so it cannot load CensusQuery

Try stripping (or commenting) out all of the code except for a println call.
This will show you if the servlet is actually being located or not.

-----Original Message-----
From: Jim Cobban [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 18, 2002 1:34 PM
To: Tomcat Users List
Subject: Re: Urgent Re: Newbie: Servlet under Windows does not run


----- Original Message -----
From: "Wagoner, Mark" <[EMAIL PROTECTED]>
Subject: RE: Urgent Re: Newbie: Servlet under Windows does not run


> What URL are you using to get to the servlet?

I have tried a very wide range of URLs.  According to all of the
documentation the one that should work is
http://localhost/servlet/Census.CensusQuery  That is using the class name.
However when that failed I also tried  /servlet/Census/CensusQuery,
and  /servlet/CensusQuery.  Since in my web.xml file, which I posted
earlier, the name of the servlet, as opposed to the class, was Census1901 I
also tried /servlet/Census1901.  I have also tried using URL mapping
specified in the
WEB-INF/web.xml file.  In any event the bottom lime is that when I request
the above URL TomCat does go looking for my class.  It just can't seem to
find it!

I know that I must be doing something wrong, because nobody else seems to be
having any difficulty running servlets, but this is driving me crazy.  I
have been trying everything I can think of for more than a week and  TomCat
keeps claiming that it can't find the class.  I have read the documentation
over and over again.  I have gone with a fine tooth comb through the
examples trying to see what they are doing that is different from what I am
doing.  I just don't understand why this is so bloody difficulty.

Just to put every bit of the documentation of this problem in one place:

The first few lines of my servlet are:

package Census;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class CensusQuery extends HttpServlet {


which I compile using the following .bat file:

set PATH=C:\jdk1.3.1\bin;%PATH%
set
CP=D:\jakarta-tomcat-3.3a\lib\common\servlet.jar;WEB-INF\classes;%CLASSPATH%
 javac -d WEB-INF/classes -classpath %CP% ConnectionPool.java | more
 javac -d WEB-INF/classes -classpath %CP% DBResults.java | more
 javac -d WEB-INF/classes -classpath %CP% DriverUtilities.java | more
 javac -d WEB-INF/classes -classpath %CP% DatabaseUtilities.java | more
 javac -d WEB-INF/classes -classpath %CP% ServletUtilities.java | more
 javac -d WEB-INF/classes -classpath %CP% CensusQuery.java | more
jar cf Census.war *.html WEB-INF


The .war file this produces contains:

D:\MyPrograms\JavaProgs\CensusServlet>jar -tf Census.war
META-INF/
META-INF/MANIFEST.MF
CensusQuery.html
WEB-INF/
WEB-INF/classes/
WEB-INF/classes/Census/
WEB-INF/classes/Census/ConnectionPool.class
WEB-INF/classes/Census/DBResults.class
WEB-INF/classes/Census/DriverUtilities.class
WEB-INF/classes/Census/DatabaseUtilities.class
WEB-INF/classes/Census/ServletUtilities.class
WEB-INF/classes/Census/CensusQuery.class
WEB-INF/web.xml

The web.xml file is:

<?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>
    <display-name>My Web Application</display-name>
    <description>
      This is version X.X of an application to perform
      a wild and wonderful task, based on servlets and
      JSP pages.  It was written by Dave Developer
      ([EMAIL PROTECTED]), who should be contacted for
      more information.
    </description>

    <servlet>
        <servlet-name>
            Census1901
        </servlet-name>
        <servlet-class>
            Census.CensusQuery
        </servlet-class>

        <init-param>
            <param-name>DbVendor</param-name>
     <param-value>mysql</param-value>
        </init-param>
        <init-param>
     <param-name>Url</param-name>
     <param-value>localhost</param-value>
        </init-param>
        <init-param>
     <param-name>DbName</param-name>
     <param-value>Census</param-value>
        </init-param>
        <init-param>
     <param-name>UserName</param-name>
     <param-value>anonymous</param-value>
        </init-param>
        <init-param>
     <param-name>Password</param-name>
     <param-value>none</param-value>
        </init-param>
        <init-param>
     <param-name>InitConnections</param-name>
     <param-value>10</param-value>
        </init-param>
        <init-param>
     <param-name>MaxConnections</param-name>
     <param-value>10</param-value>
        </init-param>

    </servlet>
<!--
    <servlet-mapping>
        <servlet-name>
     Census1901
        </servlet-name>
        <url-pattern>
     /Census
        </url-pattern>
    </servlet-mapping>
    -->
</web-app>

and the relevant lines of the log file under TomCat 4.0.3 are:

2002-03-17 14:52:33 StandardHost[localhost]: Installing web application at
context path /Census from URL
jar:file:D:\jakarta-tomcat-4.0.3\webapps\Census.war!/
2002-03-17 14:52:34 WebappLoader[/Census]: Deploying class repositories to
work directory D:\jakarta-tomcat-4.0.3\work\localhost\Census
2002-03-17 14:52:34 StandardManager[/Census]: Seeding random number
generator class java.security.SecureRandom
2002-03-17 14:52:34 StandardManager[/Census]: Seeding of random number
generator has been completed
2002-03-17 14:52:34 StandardWrapper[/Census:default]: Loading container
servlet default
2002-03-17 14:52:34 default: init
2002-03-17 14:52:34 StandardWrapper[/Census:invoker]: Loading container
servlet invoker
2002-03-17 14:52:34 invoker: init
2002-03-17 14:52:34 jsp: init
2002-03-17 14:52:55
StandardWrapper[:org.apache.catalina.INVOKER.Census.CensusQuery]: Marking
servlet org.apache.catalina.INVOKER.Census.CensusQuery as unavailable
2002-03-17 14:52:55 invoker: Cannot allocate servlet instance for path
/servlet/Census.CensusQuery
javax.servlet.ServletException: Wrapper cannot find servlet class
Census.CensusQuery or a class it depends on




--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to