I tried to change the web app to other name, it works fine now. (only one
instance). Look like it is the "ROOT" cause all problem. Any one know why the
ROOT is being called twice?
Thanks
Elwin> From: [EMAIL PROTECTED]> To: users@tomcat.apache.org> Subject: RE:
Singleton in Tomcat 6.0 not working> Date: Thu, 5 Jun 2008 17:03:30 +0000> > >
Have you tried to put in it the "ROOT"? I guess may be something work it that.
Also I created a filter (MyFilter) to test it, the following got executed twice
:> -------------> MyFilter.<init>() line: 30 >
NativeConstructorAccessorImpl.newInstance0(Constructor, Object[]) line: not
available [native method] > NativeConstructorAccessorImpl.newInstance(Object[])
line: 39 > DelegatingConstructorAccessorImpl.newInstance(Object[]) line: 27 >
Constructor<T>.newInstance(Object...) line: 513 > Class<T>.newInstance0() line:
355 > Class<T>.newInstance() line: 308 > ApplicationFilterConfig.getFilter()
line: 255 > ApplicationFilterConfig.setFilterDef(FilterDef) line: 397 >
ApplicationFilterConfig.<init>(Context, FilterDef) line: 108 >
StandardContext.filterStart() line: 3709 > StandardContext.start() line: 4356 >
StandardHost(ContainerBase).start() line: 1045 > StandardHost.start() line: 719
> StandardEngine(ContainerBase).start() line: 1045 > StandardEngine.start()
line: 443 > StandardService.start() line: 516 > StandardServer.start() line:
710 > Catalina.start() line: 578 > NativeMethodAccessorImpl.invoke0(Method,
Object, Object[]) line: not available [native method] >
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39 >
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 >
Method.invoke(Object, Object...) line: 597 > Bootstrap.start() line: 288 >
Bootstrap.main(String[]) line: 413 > > ----------> > From: [EMAIL PROTECTED]>
To: users@tomcat.apache.org> Subject: Re: Singleton in Tomcat 6.0 not working>
Date: Thu, 5 Jun 2008 17:19:57 +0200> > > ----- Original Message ----- > From:
"Mikolaj Rydzewski" <[EMAIL PROTECTED]>> To: "Tomcat Users List"
<users@tomcat.apache.org>> Sent: Thursday, June 05, 2008 5:06 PM> Subject: Re:
Singleton in Tomcat 6.0 not working> > > > ktou Ho wrote:> >> The problem I am
facing is the Singleton is not working at all in the > >> servlet. I tried to
synchnozed the constructor or make it static. I > >> still get two instances of
the objects. How can I solve the problem?> > Is anyone able to reproduce this?>
> No, for fun I gave it a spin... it worked, one count> Think ktou is going to
have to post his code> Like chuck said, something fishy ;)> On NB its easy to
mistakenly set up glassfish as the server - ha ha> > > >> public class
RemoteDBConnections> >> {> >> private static RemoteDBConnections sInstance =
new > >> RemoteDBConnections();> >> private static int counter=0;> >> private
RemoteDBConnections()> >> {> >> System.out.println("counter =" + (counter++));>
>>> > Add following line (assuming you do not override default toString
method):> >> > System.out.println(this.toString());> >> > and compare results.>
--------------------------------------------------------------------------->
HARBOR : http://www.kewlstuff.co.za/index.htm> The most powerful application
server on earth.> The only real POJO Application Server.> See it in Action :
http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm>
--------------------------------------------------------------------------- > >
> ---------------------------------------------------------------------> To
start a new topic, e-mail: users@tomcat.apache.org> To unsubscribe, e-mail:
[EMAIL PROTECTED]> For additional commands, e-mail: [EMAIL PROTECTED]> >
_________________________________________________________________> Now you can
invite friends from Facebook and other groups to join you on Windows Live™
Messenger. Add now.>
https://www.invite2messenger.net/im/?source=TXT_EML_WLH_AddNow_Now
_________________________________________________________________
Now you can invite friends from Facebook and other groups to join you on
Windows Live™ Messenger. Add now.
https://www.invite2messenger.net/im/?source=TXT_EML_WLH_AddNow_Now