tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Purcell" <spurc...@vertisinc.com>
Subject init() block not initializing?
Date Fri, 06 Dec 2002 19:33:40 GMT
Hello,

I am trying to get a servlet Initialization block to initialize but I cannot seem to get it
to work. I am running a new install of Tomcat 4.1.12 on win2000. 

I have created a webapp called "cybrary", and I have put that into the server xml with the
following line:
        <Context path="/cybrary" docBase="cybrary" debug="0"
                 reloadable="true" crossContext="true" />

Then I created the proper structure under webapps eg:
/webapps/cybrary/WEB-INF/classes/com/ddi/ags/rpc/CybraryRPCHandler.java

The code I am running is here, there is nothing to it, just want it to hit the init block.
When I run it with the following url: http://localhost:8080/cybrary/servlet/CybraryRPCHandler
the out.println message shows, but no init ever. I am printing that to stdout, in which I
never see any print.

Does anyone know why this would occur.

Also, in case needed the web.xml is below all of this:




package com.ddi.ags.rpc;

import java.io.*;
import java.util.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.xmlrpc.*;
public class CybraryRPCHandler extends HttpServlet {
    public void init() throws ServletException {
	System.out.println("IN the init");
    }

    public void doGet(HttpServletRequest request,
		      HttpServletResponse response)
	throws ServletException, IOException {
	PrintWriter out = response.getWriter();
	response.setContentType("text/html");
	out.println("this is another attempt at the init firing up.");
    }
}




#### web.xml ######
<?xml version="1.0" encoding="ISO-8859-1"?>

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

<web-app>

    <servlet>
	<servlet-name>CybraryRPCHandler</servlet-name>
	<servlet-class>com.ddi.ags.rpc.CybraryRPCHandler</servlet-class>
     </servlet>


   <servlet-mapping>
	<servlet-name>CybraryRPCHandler</servlet-name>
	<url-pattern>/servlet/CybraryRPCHandler</url-pattern>
   </servlet-mapping>

   <welcome-file-list>
	<welcome-file>index.html</welcome-file>
   </welcome-file-list>

</web-app>



--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message