You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Richard Troy <rt...@ScienceTools.com> on 2001/11/15 21:00:31 UTC

Figuring out why Tomcat isn't serving a servlet (fwd)

Date: 18 Oct 2001 01:06:18 -0000
From: Dr. Evil <dr...@sidereal.kz>
Reply-To: tomcat-user@jakarta.apache.org
To: tomcat-user@jakarta.apache.org
Subject: Figuring out why Tomcat isn't serving a servlet


I am completely stumped by a seemingly simple problem.  I have created
a very simple servlet:

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class hello extends HttpServlet {

       public void doGet(HttpServletRequest request,
       HttpServletResponse response)
       throws ServletException, IOException {

       response.setContentType("text/plain");
       PrintWriter out = response.getWriter();

       out.println("Hello");
       }
}

I place compile and place it in
/usr/local/jakarta-tomcat-4.0/webapps/test/WEB-INF/classes/hello.class.

Then, with no problem, I can access it by going to
localhost:8080/test/servlet/hello.

That's good.  Now I tried to add a web.xml file that will load up
another class which will create the database connection pool for me.
Here's what the web.xml file looks like:

<?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>
 <session-config>
  <session-timeout>120</session-timeout>
 </session-config>
 <servlet>
  <servlet-name>makepool</servlet-name>
  <servlet-class>makepool</servlet-class>
  <load-on-startup>1</load-on-startup>
 </servlet>
</web-app>

Now with that file in place, I can no longer access servlet/hello.  I
tried putting in lines for the servlet:

 <servlet>
  <servlet-name>hello</servlet-name>
  <servlet-class>hello</servlet-class>
 </servlet>

but that didn't help either.  Is there a way to get this to work?
Connection pools aren't too useful if they're the only class you can
have on your server...

It seems that figuring out paths is a chronic difficulty with Tomcat.
Is there any way to debug what Tomcat is trying to do with a
particular request?

Thanks


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>