tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "nathan phillips" <natha...@hotmail.com>
Subject Re: Virtual Hosts problem with Singleton Class
Date Thu, 01 Jan 1970 00:00:00 GMT
I don't believe you can do that in Tomcat but I may be wrong.  The easiest 
and cleanest approach would be too have your Singleton located in each 
respective war file that you plan on using it in.  Then eliminate it from 
the classpath.

i.e  Place the singleton in the WEB-INF/classes directory


From: "Haris Papadopoulos" <haris@softways.gr>
Reply-To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
Subject: Re: Virtual Hosts problem with Singleton Class
Date: Mon, 18 Feb 2002 19:36:05 +0200
MIME-Version: 1.0
Received: from [192.18.49.131] by hotmail.com (3.2) with ESMTP id 
MHotMailBE3A860B0058400438E4C0123183CED40; Mon, 18 Feb 2002 09:34:03 -0800
Received: (qmail 11341 invoked by uid 97); 18 Feb 2002 17:33:45 -0000
Received: (qmail 11330 invoked from network); 18 Feb 2002 17:33:45 -0000
>From tomcat-user-return-11322-nathanpp Mon, 18 Feb 2002 09:34:18 -0800
Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm
Precedence: bulk
List-Unsubscribe: <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
List-Subscribe: <mailto:tomcat-user-subscribe@jakarta.apache.org>
List-Help: <mailto:tomcat-user-help@jakarta.apache.org>
List-Post: <mailto:tomcat-user@jakarta.apache.org>
List-Id: "Tomcat Users List" <tomcat-user.jakarta.apache.org>
Delivered-To: mailing list tomcat-user@jakarta.apache.org
Message-ID: <00ca01c1b8a2$be5b6d00$45848cd5@softways.lan>
References: <F48TgpCpt0qilwNiwlq000053d6@hotmail.com>
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
X-Message: scanned for viruses by DATAWAYS SMTP ANTIVIRUS SERVICE 
(abuse@dataways.gr)
X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N

This makes sense. My Singleton class, since it's common for all virtual
hosts, sits in the default classpath.
Can I define a class path for the class loader of each web app so that the
default class loader is never invoked?

----- Original Message -----
From: "nathan phillips" <nathanpp@hotmail.com>
To: <tomcat-user@jakarta.apache.org>
Sent: Monday, February 18, 2002 5:20 PM
Subject: Re: Virtual Hosts problem with Singleton Class


 >
 > The singletons should work fine I believe.  Each web application will get
 > its own classloader which will load only one instance of each singleton.
 > Since web application classloader have no insight to any other web
 > application class loader, this shouldn't be an issue.  Insure that your
 > singleton is located only in your war file and didn't accidently end up 
on
 > your classpath somehow.  If this happens, then of course the default
 > classloader will load your class and your web applications will use that
 > instance.
 >
 >
 >
 > From: "Haris Papadopoulos" <haris@softways.gr>
 > Reply-To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
 > To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
 > Subject: Re: Virtual Hosts problem with Singleton Class
 > Date: Mon, 18 Feb 2002 19:03:12 +0200
 > MIME-Version: 1.0
 > Received: from [192.18.49.131] by hotmail.com (3.2) with ESMTP id
 > MHotMailBE3A7EC000CB40043896C0123183D62F0; Mon, 18 Feb 2002 09:02:57 
-0800
 > Received: (qmail 7506 invoked by uid 97); 18 Feb 2002 17:02:40 -0000
 > Received: (qmail 7495 invoked from network); 18 Feb 2002 17:02:39 -0000
 > >From tomcat-user-return-11314-nathanpp Mon, 18 Feb 2002 09:04:24 -0800
 > Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm
 > Precedence: bulk
 > List-Unsubscribe: <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
 > List-Subscribe: <mailto:tomcat-user-subscribe@jakarta.apache.org>
 > List-Help: <mailto:tomcat-user-help@jakarta.apache.org>
 > List-Post: <mailto:tomcat-user@jakarta.apache.org>
 > List-Id: "Tomcat Users List" <tomcat-user.jakarta.apache.org>
 > Delivered-To: mailing list tomcat-user@jakarta.apache.org
 > Message-ID: <00b401c1b89e$25e73ee0$45848cd5@softways.lan>
 > References: <KJEPIEHDGEEMLHBCALNCIEIPCDAA.mayad@ogilvy.net>
 > X-Priority: 3
 > X-MSMail-Priority: Normal
 > X-Mailer: Microsoft Outlook Express 6.00.2600.0000
 > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
 > X-Message: scanned for viruses by DATAWAYS SMTP ANTIVIRUS SERVICE
 > (abuse@dataways.gr)
 > X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N
 >
 > I agree. But what about contexts? Since I come from Resin, the
 > implementation there is different. The Singleton object is created once
for
 > a separate context. Is this an implementation isssue?
 >
 > ----- Original Message -----
 > From: "Mark Ayad" <mayad@ogilvy.net>
 > To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>;
 > <haris@softways.gr>
 > Sent: Tuesday, February 19, 2002 3:45 AM
 > Subject: RE: Virtual Hosts problem with Singleton Class
 >
 >
 >  > something your missing
 >  >
 >  > A Singleton by it's name creates only a single instance of an object
 > (hence
 >  > it marshalls object creation i.e. one instance) which is totally
 > acceptable
 >  > for a DB connection pool.
 >  >
 >  > Regards
 >  >
 >  > Mark
 >  >
 >  > -----Original Message-----
 >  > From: Haris Papadopoulos [mailto:haris@softways.gr]
 >  > Sent: 18 February 2002 08:38
 >  > To: tomcat-user@jakarta.apache.org
 >  > Subject: Virtual Hosts problem with Singleton Class
 >  >
 >  >
 >  > Hi,
 >  > I 've configured two virtual hosts under Tomcat 4.0.1 working with
Apache
 >  > 1.3.20. They both load (on startup) a Servlet which creates a 
Singleton
 >  > object that (in turn) creates a DB pool. Both servlets are defined in
the
 >  > separate web.xml files.
 >  > It seems that the second servlet does not create the pooling object 
but
 >  > instead it gets an Instance of the one created by the first one
(strange
 >  > enough since they exist in different contexts).
 >  > Everything else seems to work in the appropriate virtual host context.
Is
 >  > this a matter concerning Singleton objects and maybe a bug, or is 
there
 >  > something I 'm missing?
 >  > We 're trying to migrate to Tomcat from Resin and I haven't found any
 >  > relative info so far regarding this problem.
 >  > Thanks in advance.
 >  >
 >  >
 >  > --
 >  > To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
 >  > For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
 >  > Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
 >  >
 >
 >
 >
 > --
 > To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
 > For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
 > Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
 >
 >
 >
 >
 >
 > _________________________________________________________________
 > Send and receive Hotmail on your mobile device: http://mobile.msn.com
 >
 >
 > --
 > To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
 > For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
 > Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>



--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>





_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message