You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by David Hemingway <dh...@datafast.net.au> on 2003/01/14 01:05:24 UTC
Listener problem in tomcat 4.1.18
Hi,
This has been posted before, this time i have made it more thorough.
My top of my context inside my server.xml looks like:
<Context path="/lawonline" docBase="lawonline" debug="0"
reloadable="false" crossContext="true">
my web.xml looks like:
<listener>
<listener-class>
com.lawonline.StartServlet
</listener-class>
</listener>
The code in the listener:
public void contextInitialized(ServletContextEvent sce)
{
sce.getServletContext().setAttribute("startServlet", this);
System.out.println("Context Initialized");
synchronized(this)
{
if(!hasBeenInitialized)
{
scheduler = Scheduler.getScheduler();
System.out.println("The listener is: "+this);
hasBeenInitialized = true;
}
}
System.out.println("Got Scheduler Instance");
}
When server start the listener starts up as expected. However upon the first request 2 more instances are created straight away. Does anyne know what could cause this and furthermore how to rectify the situation. I only want ONE instance as multiple instances causes major concurrency issues. Thanks in advance
regards,
Dave
Re: Listener problem in tomcat 4.1.18
Posted by David Hemingway <dh...@datafast.net.au>.
I guess that might be possible. I am not using wars or jars for my webapp
itself, the context is in an exploded form in the webapps directory thats
it. How can I stop multiple instances of the web app starting? I need the
context in the server.xml to create my JNDI DataSource. Thanks
regards,
Dave
----- Original Message -----
From: "Alexander Wallace" <aw...@rwsoft-online.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Tuesday, January 14, 2003 11:12 AM
Subject: Re: Listener problem in tomcat 4.1.18
> Could you be running multiple instances of your web app? Like it would
happen
> if you have a context for it declared in server.xml and also have a jar or
a
> directory in webapps. ?
>
>
> On Monday 13 January 2003 18:05, David Hemingway wrote:
> > Hi,
> > This has been posted before, this time i have made it more thorough.
> >
> > My top of my context inside my server.xml looks like:
> >
> > <Context path="/lawonline" docBase="lawonline" debug="0"
> > reloadable="false" crossContext="true">
> >
> > my web.xml looks like:
> >
> > <listener>
> > <listener-class>
> > com.lawonline.StartServlet
> > </listener-class>
> > </listener>
> >
> >
> >
> > The code in the listener:
> >
> >
> > public void contextInitialized(ServletContextEvent sce)
> > {
> > sce.getServletContext().setAttribute("startServlet", this);
> > System.out.println("Context Initialized");
> >
> > synchronized(this)
> > {
> > if(!hasBeenInitialized)
> > {
> > scheduler = Scheduler.getScheduler();
> > System.out.println("The listener is: "+this);
> > hasBeenInitialized = true;
> > }
> > }
> >
> > System.out.println("Got Scheduler Instance");
> > }
> >
> >
> > When server start the listener starts up as expected. However upon the
> > first request 2 more instances are created straight away. Does anyne
know
> > what could cause this and furthermore how to rectify the situation. I
only
> > want ONE instance as multiple instances causes major concurrency issues.
> > Thanks in advance
> >
> > regards,
> > Dave
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Listener problem in tomcat 4.1.18
Posted by Alexander Wallace <aw...@rwsoft-online.com>.
Could you be running multiple instances of your web app? Like it would happen
if you have a context for it declared in server.xml and also have a jar or a
directory in webapps. ?
On Monday 13 January 2003 18:05, David Hemingway wrote:
> Hi,
> This has been posted before, this time i have made it more thorough.
>
> My top of my context inside my server.xml looks like:
>
> <Context path="/lawonline" docBase="lawonline" debug="0"
> reloadable="false" crossContext="true">
>
> my web.xml looks like:
>
> <listener>
> <listener-class>
> com.lawonline.StartServlet
> </listener-class>
> </listener>
>
>
>
> The code in the listener:
>
>
> public void contextInitialized(ServletContextEvent sce)
> {
> sce.getServletContext().setAttribute("startServlet", this);
> System.out.println("Context Initialized");
>
> synchronized(this)
> {
> if(!hasBeenInitialized)
> {
> scheduler = Scheduler.getScheduler();
> System.out.println("The listener is: "+this);
> hasBeenInitialized = true;
> }
> }
>
> System.out.println("Got Scheduler Instance");
> }
>
>
> When server start the listener starts up as expected. However upon the
> first request 2 more instances are created straight away. Does anyne know
> what could cause this and furthermore how to rectify the situation. I only
> want ONE instance as multiple instances causes major concurrency issues.
> Thanks in advance
>
> regards,
> Dave
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>