you can put your singleton in \tomcat\lib so that it is shared by all
contexts with the common classloader. This will give you only one instance
for tomcat, which it sound like you are looking for.

see the classloader doc for tomcat
Charlie

> -----Original Message-----
> From: Haris Papadopoulos [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 18, 2002 12:36 PM
> To: Tomcat Users List
> Subject: Re: Virtual Hosts problem with Singleton Class
> 
> 
> 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" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> 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" <[EMAIL PROTECTED]>
> > Reply-To: "Tomcat Users List" <[EMAIL PROTECTED]>
> > To: "Tomcat Users List" <[EMAIL PROTECTED]>
> > 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 [EMAIL PROTECTED]; 
> run by ezmlm
> > Precedence: bulk
> > List-Unsubscribe: 
> <mailto:[EMAIL PROTECTED]>
> > List-Subscribe: <mailto:[EMAIL PROTECTED]>
> > List-Help: <mailto:[EMAIL PROTECTED]>
> > List-Post: <mailto:[EMAIL PROTECTED]>
> > List-Id: "Tomcat Users List" <tomcat-user.jakarta.apache.org>
> > Delivered-To: mailing list [EMAIL PROTECTED]
> > Message-ID: <00b401c1b89e$25e73ee0$[EMAIL PROTECTED]>
> > References: <[EMAIL PROTECTED]>
> > 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
> > ([EMAIL PROTECTED])
> > 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" <[EMAIL PROTECTED]>
> > To: "Tomcat Users List" <[EMAIL PROTECTED]>;
> > <[EMAIL PROTECTED]>
> > 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:[EMAIL PROTECTED]]
> >  > Sent: 18 February 2002 08:38
> >  > To: [EMAIL PROTECTED]
> >  > 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:[EMAIL PROTECTED]>
>  > For additional commands: <mailto:[EMAIL PROTECTED]>
>  > Troubles with the list: <mailto:[EMAIL PROTECTED]>
>  >
>
>
>
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
>
>
>
>
>
> _________________________________________________________________
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
>
>
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>



--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to