Hi!

I think I have the exact same problem as you. I have two servlets, one under /tomcat/webapps/ROOT/ and another under
/tomcat/webapps/anotherapp/
For the latter servlet I get four instances(!). But the first only one instance (normal case?)

There are no duplicates in the web.xml files either.

I really think that this is a serious bug...

BR
Magnus




----- Original Message ----- From: "dirk ooms" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Tuesday, June 27, 2006 3:04 PM
Subject: Re: multiple instances of load-on-startup classes


i had something similar and the reason then was that i had duplicate context definition files. it seems that your context definition is not in server.xml,
so you might check whether there are duplicate context files somewhere in
tomcat/conf/...

dirk

On Tuesday 27 June 2006 13:43, Mark Benussi wrote:
We have a webapp running within Tomcat 5.0.28 on Linux.
The message log indicates that any <load-on-startup> classes are loaded
twice. Also, any singleton objects created by these load-on-startup classes are created twice. This has been confirmed by stepping through the code via
a debugger.

>From what I have gathered from web search it looks like the webapp is
> being

loaded twice - each instance of the webapp uses a seperate class-loader
which accounts for seeing multiple instances of singleton objects.

Can anyone shed any light on what may is going on here. Is the webapp being
loaded twice? Is there a problem with Tomcat's server.xml?

I have included the application log, server.xml and web.xml below:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Applic
ation Log
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

DEBUG 10:37:29,411 CpmDigester:CpmDigester(...) - Config file name =
'/usr/local/home/paphdv14/.cpm.xml'
DEBUG 10:37:29,527 CpmDigester:loadResults() - About to parse config file
DEBUG 10:37:29,682 CpmDigester:loadResults() - config file parsed
DEBUG 10:37:30,279 Information on the connection pool 'WEBCP'...
DEBUG 10:37:30,279   Number of active connections = 1
DEBUG 10:37:30,279   Number of idle connections = 0
INFO  10:37:31,369 Loading validation rules file from
'/WEB-INF/validator-rules.xml'
INFO  10:37:31,375 Loading validation rules file from
'/WEB-INF/validation-web.xml'
INFO  10:37:31,705 Tiles definition factory loaded for module '/web'.
DEBUG 10:37:31,731 WebLoginInitialiserPlugIn:init() - START
INFO  10:37:31,851 Tiles definition factory loaded for module '/imm'.
INFO  10:37:31,851 Loading validation rules file from
'/WEB-INF/validator-rules.xml'
INFO  10:37:31,851 Loading validation rules file from
'/WEB-INF/validation-imm.xml'
INFO 10:37:32,039 WebApplicationInitialisation:init(...) - Web application
initialisation starting...
INFO  10:37:32,039 WebApplicationInitialisation:init(...) - Initialising
context parameters.
DEBUG 10:37:32,039 WebApplicationInitialisation:init(...) - param =
./web/mainPage.do

DEBUG 10:37:33,114 CpmDigester:CpmDigester(...) - Config file name =
'/usr/local/home/paphdv14/.cpm.xml'
DEBUG 10:37:33,154 CpmDigester:loadResults() - About to parse config file
DEBUG 10:37:33,279 CpmDigester:loadResults() - config file parsed
DEBUG 10:37:33,816 Information on the connection pool 'WEBCP'...
DEBUG 10:37:33,817   Number of active connections = 1
DEBUG 10:37:33,817   Number of idle connections = 0
INFO  10:37:34,473 Loading validation rules file from
'/WEB-INF/validator-rules.xml'
INFO  10:37:34,475 Loading validation rules file from
'/WEB-INF/validation-web.xml'
INFO  10:37:34,854 Tiles definition factory loaded for module '/web'.
DEBUG 10:37:34,866 WebLoginInitialiserPlugIn:init() - START
INFO  10:37:34,918 Tiles definition factory loaded for module '/imm'.
INFO  10:37:34,918 Loading validation rules file from
'/WEB-INF/validator-rules.xml'
INFO  10:37:34,918 Loading validation rules file from
'/WEB-INF/validation-imm.xml'
INFO 10:37:34,982 WebApplicationInitialisation:init(...) - Web application
initialisation starting...
INFO  10:37:34,982 WebApplicationInitialisation:init(...) - Initialising
context parameters.
DEBUG 10:37:34,982 WebApplicationInitialisation:init(...) - param =
./web/mainPage.do

&#65279;<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee";
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
         version="2.4">
<description></description>
<filter>
  <filter-name>SessionFilter</filter-name>
  <filter-class>uk.co.etc.web.session.filter.SessionFilter</filter-class>
</filter>
<filter-mapping>
  <filter-name>SessionFilter</filter-name>
  <url-pattern>*.do</url-pattern>
</filter-mapping>
<filter-mapping>
  <filter-name>SessionFilter</filter-name>
  <url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
  <filter-name>SessionFilter</filter-name>
  <url-pattern>/servlet/*</url-pattern>
</filter-mapping>
<servlet>
  <servlet-name>web-app-init</servlet-name>

<servlet-class>uk.co.etc.web.session.init.WebApplicationInitialisation</ser
vlet-class> <init-param>
   <param-name>mainPageUri</param-name>
   <param-value>/web/mainPage.do</param-value>
  </init-param>
...
  <load-on-startup>0</load-on-startup>
</servlet>
<servlet>
  <servlet-name>action</servlet-name>
  <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
  <init-param>
   <param-name>config</param-name>
   <param-value>/WEB-INF/struts-config-main.xml</param-value>
  </init-param>
  <init-param>
   <param-name>config/web</param-name>
   <param-value>/WEB-INF/struts-config-web.xml</param-value>
  </init-param>
  <init-param>
   <param-name>debug</param-name>
   <param-value>3</param-value>
  </init-param>
  <init-param>
   <param-name>detail</param-name>
   <param-value>2</param-value>
  </init-param>
  <load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
  <servlet-name>action</servlet-name>
  <url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
  <welcome-file>/index.jsp</welcome-file>
</welcome-file-list>


</web-app>

<Server port="12106" shutdown="SHUTDOWN" debug="0">

<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
            debug="0"/>
  <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
            debug="0"/>

  <!-- Define the Tomcat Stand-Alone Service -->
  <Service name="Catalina">

    <!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -->
    <Connector port="12180"
               maxThreads="100" minSpareThreads="5" maxSpareThreads="10"
enableLookups="false" redirectPort="8443" acceptCount="100"
               debug="0" connectionTimeout="20000"
               disableUploadTimeout="true" />

    <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
    <Connector port="12109"
               enableLookups="false" redirectPort="8443" debug="0"
               protocol="AJP/1.3" />


    <!-- Define the top level container in our container hierarchy -->
    <Engine name="Catalina" defaultHost="paphdv14" debug="0">
      <!-- Global logger unless overridden at lower levels -->
      <Logger className="org.apache.catalina.logger.FileLogger"
              prefix="catalina_log." suffix=".txt"
              timestamp="true"/>
  <Host name="paphdv14" appBase="webapps">
          <Logger className="org.apache.catalina.logger.FileLogger"
                   directory="logs"  prefix="paphdv14." suffix=".log"
timestamp="true"/>
  </Host>
    </Engine>
  </Service>
</Server>



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

__________ NOD32 1.1627 (20060627) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to