RE: Problem with initialize servlet - load-on-startup

2003-12-20 Thread Les Dunaway
OK, I found the problem and in the process learned something I DID NOT
want to know.

The mistake I made was a typo - the class is
com.glsi.share.ApplicationInitialize and I typed
com.glsi.share.ApplicationInitialze.

It makes perfectly good sense that when Tomcat went to load the class, I
should have seen class not found or some such.  However, it is REALLY
ugly that the whole servlet.../servlet entry in web.xml was just
ignored.

I have debug on.  Is there another setting that I should have on? 

Someone please tell me that this is NOTexpected behavior?  Should I be
posting this to Tomcat?

Les


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Problem with initialize servlet - load-on-startup

2003-12-17 Thread Les Dunaway
I'm running Tomcat 406 on Redhat9

I have a working Struts app

I've added a second servlet to web.xml, specifying load-on-startup 2
(where 1 is Action servlet

The second servlet is ignored (or at least it doesn't produce anything
in the logs) - the log shows the parsing of the web.xml going normally
(no errors).

Can anyone tell me what I didn't do / did wrong?

Les
+ web.xml +++
?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

  !-- Standard Action Servlet Configuration (with debugging) --
  servlet
servlet-nameaction/servlet-name
   
servlet-classorg.apache.struts.action.ActionServlet/servlet-class
init-param
  param-nameconfig/param-name
  param-value/WEB-INF/struts-config.xml/param-value
/init-param
init-param
  param-namedebug/param-name
  param-value3/param-value
/init-param
init-param
  param-namedetail/param-name
  param-value2/param-value
/init-param
load-on-startup1/load-on-startup
  /servlet
  
!-- Initialization servlet --
servlet
servlet-nameglsi-init/servlet-name
   
servlet-classcom.glsi.share.ApplicationInitialze/servlet-class
init-param
param-nameglsi-config/param-name
   
param-value/WEB-INF/classes/glsi-config.properties/param-value
/init-param
load-on-startup2/load-on-startup
/servlet

  !-- Standard Action Servlet Mapping --
  servlet-mapping
servlet-nameaction/servlet-name
url-pattern*.do/url-pattern
  /servlet-mapping
  
  !-- The Usual Welcome File List --
  welcome-file-list
welcome-fileindex.jsp/welcome-file
  /welcome-file-list


  !-- Struts Tag Library Descriptors --
  taglib
taglib-uri/tags/struts-bean/taglib-uri
taglib-location/WEB-INF/struts-bean.tld/taglib-location
  /taglib

  taglib
taglib-uri/tags/struts-html/taglib-uri
taglib-location/WEB-INF/struts-html.tld/taglib-location
  /taglib

  taglib
taglib-uri/tags/struts-logic/taglib-uri
taglib-location/WEB-INF/struts-logic.tld/taglib-location
  /taglib

  taglib
taglib-uri/tags/struts-nested/taglib-uri
taglib-location/WEB-INF/struts-nested.tld/taglib-location
  /taglib

  taglib
taglib-uri/tags/struts-tiles/taglib-uri
taglib-location/WEB-INF/struts-tiles.tld/taglib-location
  /taglib

/web-app


+ The servlet 
/*
 * ApplicationInitialize.java
 *
 * Created on December 15, 2003, 12:36 PM
 */

package com.glsi.share;

import java.io.*;
import java.net.*;

import java.util.Properties;

import javax.servlet.*;
import javax.servlet.http.*;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Performs initialization for glsi class-libraries-based applications
 * @author  Les
 * @version
 */
public class ApplicationInitialize extends HttpServlet {
  
  /**
   *  The codeLog/code instance for this application.
   */
  private Log log =
  LogFactory.getLog(com.glsi.share.ApplicationInitialize);
  
  /** Initializes the servlet.
   */
  public void init(ServletConfig config) throws ServletException {
super.init(config);
System.out.println(Hi there, I'm the
initializer);
String cfgPathName = config.getInitParameter(config);
Properties cfgProps = new Properties();
try{
cfgProps.load(new FileInputStream(cfgPathName));
} catch (Exception ie) {
  log.info(Error loading glsi-config.properties +
ie.getMessage());
}
log.info(glsi-config.properties loaded);
  }
  
  /** Destroys the servlet.
   */
  public void destroy() {

  }
  
  /** Processes requests for both HTTP codeGET/code and
codePOST/code methods.
   * @param request servlet request
   * @param response servlet response
   */
  protected void processRequest(HttpServletRequest request,
HttpServletResponse response)
  throws ServletException, IOException {
response.setContentType(text/html);
PrintWriter out = response.getWriter();
/* output your page here
out.println(html);
out.println(head);
out.println(titleServlet/title);
out.println(/head);
out.println(body);
 
out.println(/body);
out.println(/html);
 */
out.close();
  }
  
  /** Handles the HTTP codeGET/code method.
   * @param request servlet request
   * @param response servlet response
   */
  protected void doGet(HttpServletRequest request, HttpServletResponse
response)
  throws ServletException, IOException {
processRequest(request, response);
  }
  
  /** Handles the HTTP codePOST/code method.
   * @param request servlet request
   * @param response servlet response
   */
  protected void doPost(HttpServletRequest request, HttpServletResponse
response)
  throws ServletException, IOException {
processRequest(request, response);
  }
  
  /** Returns a short description of the