Hi everyone,

I'm having trouble getting servlet mapping to work under Tomcat
4.0-1-b1. 

In previous version of Tomcat, it was enough to just put your servlet
mapping class in the "classes" directory under $TOMCAT_HOME and add this
to your web.xml file:

 <servlet-mapping>
       <servlet-name>
           PyServlet
       </servlet-name>
       <url-pattern>
           *.py
       </url-pattern>
  </servlet-mapping>

and everything worked!  If I do this with Tomcat 4.0-1-b1, I get this
error when starting Tomcat.
------------------------------------------
Using CATALINA_HOME: /home/mddevel/MD8/packages/jakarta-tomcat-4.0-b1/
Starting service Tomcat-Standalone
Apache Tomcat/4.0-b1
ERROR reading java.io.FileInputStream@11c97e2
At Line 68 /web-app/servlet-mapping/ 

ERROR reading java.io.FileInputStream@1b52828
At Line 68 /web-app/servlet-mapping/ 

ERROR reading java.io.FileInputStream@1fb6e39
At Line 68 /web-app/servlet-mapping/ 

ERROR reading java.io.FileInputStream@5e10f8
At Line 68 /web-app/servlet-mapping/ 

ERROR reading java.io.FileInputStream@1ceb934
At Line 68 /web-app/servlet-mapping/ 

Starting service Tomcat-Apache
----------------------------------------
So, I tried looking at the structure of the other servlet mapping files
in web.xml and noticed that I might need to do this:
 <servlet>
    <servlet-name>PyServlet</servlet-name>
    <servlet-class>md8.util.PyServlet</servlet-class>
  </servlet>

Everything seems to work when I startup Tomcat, but when I run a .py
file (which should map it to PyServlet), it produces this error:

-----------------------------------------
A Servlet Exception Has Occurred

Exception Report:

javax.servlet.ServletException: Class md8.util.PyServlet is not a Servlet
        at java.lang.Throwable.fillInStackTrace(Native Method)
        at java.lang.Throwable.fillInStackTrace(Compiled Code)
        at java.lang.Throwable.(Compiled Code)
        at java.lang.Exception.(Compiled Code)
                        .
                        .
                        .
Root Cause:

java.lang.ClassCastException: md8.util.PyServlet
        at org.apache.catalina.core.StandardWrapper.load(Compiled Code)
        at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:544)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:227)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:196)
                        .
                        .
                        .
----------------------------------------------
Can someone shed some light what might be happing? This class IS a
servlet:

public class PyServlet extends HttpServlet {
    static Hashtable servlets = new Hashtable(); // Cache for PyServlets
    static Hashtable dates = new Hashtable();   // Timestamps for Cache entries
    PythonInterpreter interp = new PythonInterpreter(); 
                        .
                        .
                        .

Again, this used to work under the previous version of Tomcat just fine
and it was considered to be a servlet.  

Thanks,
Chris

-- 
 __________________________________________________
/\                                                 \
\_| Christopher D. Gokey, SSAI, NASA/GCMD          |
  | 18 Martin Road, Shelburne Falls, MA  01370     |
  | Phone: Voice (413) 625-8129 / FAX 208-248-9055 |
  | [EMAIL PROTECTED] / http://gcmd.nasa.gov    |
  | ICQ #52132386, AOL IM: chrisgokey              |
  |   _____________________________________________|_
   \_/______________________________________________/


Reply via email to