Re: multiple instances of load-on-startup classes

2006-06-27 Thread Magnus Larsgården

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-nameSessionFilter/filter-name
  filter-classuk.co.etc.web.session.filter.SessionFilter/filter-class
/filter
filter-mapping
  filter-nameSessionFilter/filter-name
  url-pattern*.do/url-pattern
/filter-mapping
filter-mapping
  filter-nameSessionFilter/filter-name
  url-pattern*.jsp/url-pattern
/filter-mapping
filter-mapping
  filter-nameSessionFilter/filter-name
  url-pattern/servlet/*/url-pattern
/filter-mapping
servlet
  

Re: Multiple instances of servlets

2006-06-16 Thread Magnus Larsgården

Hi Len,

The SingleThreadModel Interface is _not_ used in the servlet.

Maybe I should write a bugreport?

Thanks for your help!

BR/Magnus




- Original Message - 
From: Len Popp [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Friday, June 16, 2006 6:30 PM
Subject: Re: Multiple instances of servlets


I don't see anything there that would cause the servlet in mydomain2
to be loaded 4 times. The only thing I can think of is that the
servlet might be running in single-thread mode (by implementing the
SingleThreadModel interface).
--
Len

On 6/14/06, Magnus Larsgården [EMAIL PROTECTED] wrote:

Hi Len!

This is how my two web.xml files look like:

/home/web/tomcat/webapps/ROOT/WEB-INF/web.xml

!--
**  --
!--
**  --
servlet

servlet-namecom.mydomain1.bookingManager.BookingManager/servlet-name

servlet-classcom.mydomain1.bookingManager.BookingManager/servlet-class
load-on-startup1/load-on-startup
/servlet
servlet-mapping

servlet-namecom.mydomain1.bookingManager.BookingManager/servlet-name

url-pattern/servlet/com.mydomain1.bookingManager.BookingManager/url-pattern
/servlet-mapping


!--
**  --
!--
**  --
servlet --
  servlet-namecom.mydomain1.log.Log/servlet-name
  servlet-classcom.mydomain1.log.Log/servlet-class
/servlet
servlet-mapping
servlet-namecom.mydomain1.log.Log/servlet-name
url-pattern/servlet/com.mydomain1.log.Log/url-pattern
/servlet-mapping

!--
**  --
!--
**  --
servlet --
  servlet-namecom.mydomain1.poll.PollMain/servlet-name
  servlet-classcom.mydomain1.poll.PollMain/servlet-class
/servlet
servlet-mapping
servlet-namecom.mydomain1.poll.PollMain/servlet-name
url-pattern/servlet/com.mydomain1.poll.PollMain/url-pattern
/servlet-mapping

!--
**  --
!--
**  --
servlet --

servlet-namecom.mydomain1.discgolf.bookingManager.BookingManager/servlet-name

servlet-classcom.mydomain1.discgolf.bookingManager.BookingManager/servlet-class
  load-on-startup2/load-on-startup
/servlet
servlet-mapping

servlet-namecom.mydomain1.discgolf.bookingManager.BookingManager/servlet-name

url-pattern/servlet/com.mydomain1.discgolf.bookingManager.BookingManager/url-pattern
/servlet-mapping

!--
**  --
!--
**  --
servlet --
  servlet-namecom.mydomain1.discgolf.poll.PollMain/servlet-name
  servlet-classcom.mydomain1.discgolf.poll.PollMain/servlet-class
/servlet
servlet-mapping
servlet-namecom.mydomain1.discgolf.poll.PollMain/servlet-name

url-pattern/servlet/com.mydomain1.discgolf.poll.PollMain/url-pattern
/servlet-mapping



/home/web/tomcat/webapps/mydomain2/WEB-INF/web.xml

!--
**  --
!--
**  --
servlet

servlet-namecom.mydomain2.bookingManager.BookingManager/servlet-name

servlet-classcom.mydomain2.bookingManager.BookingManager/servlet-class
load-on-startup1/load-on-startup
!-- load-on-startup1/load-on-startup --
/servlet
servlet-mapping

servlet-namecom.mydomain2.bookingManager.BookingManager/servlet-name

url-pattern/servlet/com.mydomain2.bookingManager.BookingManager/url-pattern
/servlet-mapping



As I mentioned earlier it is mydomain2 that get four instances of the
BookingManager servlet.

Comments?

Thanks
/Magnus







- Original Message -
From: Len Popp [EMAIL PROTECTED]
To: Tomcat Users List users@tomcat.apache.org
Sent: Wednesday, June 14, 2006 4:44 PM
Subject: Re: Multiple instances of servlets


How many web.xml files do you have, and how many servlet
declarations are there in those files? Each one of those is a
different servlet (even if some of them happen to be implemented by
similar Java classes). Normally, Tomcat will create one instance of
each of those servlets (or one per JVM in a distributed application).
Things are different if you use the single-thread model, but that's
not recommended.

See the servlet spec for the official details.
--
Len

On 6/14/06, Magnus Larsgården [EMAIL PROTECTED] wrote:
 Hi all,

 Is Tomcat supposed to create multiple instances of my servlet at 
 startup?

 Or
 is it a bug?

 Background:
 
 I have two different domains connected to my

Multiple instances of servlets

2006-06-14 Thread Magnus Larsgården

Hi all,

Is Tomcat supposed to create multiple instances of my servlet at startup? Or 
is it a bug?


Background:

I have two different domains connected to my Tomcat server (version 5.5.17):
http://mydomain1.host.com  and
http://mydomain2.host.com

mydomain1 is directed to /home/web/tomcat/webapps/ROOT/
and mydomain2 is directed to /home/web/tomcat/webapps/mydomain2/

Both domains use a copy of the same servlet except that they belong to 
different packages. Ex:
The .java files under mydomain1 belong to package 
com.mydomain1.bookingManager  and are located under

/home/web/tomcat/webapps/ROOT/WEB-INF/classes/com/mydomain1/bookingManager/

The .java files under mydomain2 belong to package 
com.mydomain2.bookingManager and are located under

/home/web/tomcat/webapps/mydomain2/WEB-INF/classes/com/mydomain2/bookingManager/

Problem:
==
When Tomcat starts it creates only ONE instance of the mydomain1 -servlet, 
and FOUR instances of the mydomain2 servlet.
I would really like to only have ONE instance of each servlet. How can I 
achieve this?


I have searched Google for answers but only found contradicting statements. 
Some say that Tomcat creates one, and only one instance of each servlet. 
Other say the opposite.



All help is appreciated!

Thanks in advance
BR/Magnus







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