You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Tim Funk <fu...@joedog.org> on 2005/09/30 15:56:09 UTC

Re: Multiple Threads for one webapp

It seems you have a thread started in the background during the life of the 
application.
This thread goes to some external place of storage and to look for emails to 
send.
It seems this thread is not stopped when a context is reloaded.
When the app is reloaded - a new thread is started.
In this case - the app was restarted 6 times - leaving you 7 threads all 
looking to the smae external loctation for sending emails.

Solution: Use a ServletContextListerner to detect webapp shutdown so the 
thread may be stopped.


-Tim

Mahesh S Kudva wrote:

> Hi All
>  
>  I have setup virtual hosts for 3 apps with virtual hosts config as 
>  follows. These virtual hosts are first handled by Apache and mod_jk. My 
>  apps have scheduler and automated mailing services.
>  
>  <Host name="vhost.domain.com" debug="0" appBase=”deploy” 
> unpackWARs="true">
>          <Alias>www.vhost.domain.com</Alias>
>          <Logger className="org.apache.catalina.logger.FileLogger"
>              directory="${jboss.server.home.dir}/log" 
> prefix="vhost_log1."  suffix=".log" timestamp="true"/>
>           <Context path="" 
>  docBase="${jboss.server.home.dir}/deploy/application.war" debug="0" 
>  reloadable="true"/>
>  </Host>
>  
> This config is mailing the same mail 7 time. Further I noticed that 
> there  were 7 service started of the same kind. Querying the developer, 
> he said that he had coded the apps to have the mail sent once every week. 
> The mails are sent once every week but as said 7 copies of the same mail 
> is delivered.
>  
>  The request for the app results in page not found if I follow the 
>  following config, even thought there is no error in startup.
>  
>  <Context path="application" 
>  docBase="${jboss.server.home.dir}/deploy/application.war" debug="0" 
>  reloadable="true"/>
>  
>  
>  
>  Can you guys have any idea on this and help me troubleshoot ???
>  
>  
>  Regards & Thanks
>  ================
>  Mahesh S Kudva
> 
> 
> -------------------------------------------------------
> Robosoft Technologies - Partners in Product Development
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Multiple Threads for one webapp

Posted by sudip shrestha <su...@gmail.com>.
If you are using tomcat 5.5.x, you are not recommended to put <context>
element in the server.xml file according to the tomcat-docs...
so leaving the <host> element as it is, define this in a context-xml file
which should be in $tomcat-home/conf/Catalina/<host-name>/<app-name>.xml.
You can define your other Resource attributes such as jdbc connection pools
as such in here.
If you define your context in server.xml, tomcat creates another in the same
location thereby resulting in multiple context-deployments.

I had the similar problem earlier: I am using jdbc and ldap connection pools
and found that those resources were being initialized twice.

On 9/30/05, Tim Funk <fu...@joedog.org> wrote:
>
> I think JBOSS support (or mailing list) would be more helpful. Everything
> described below doesn't make any sense to those of us who don't use JBOSS.
>
> -Tim
>
> Mahesh S Kudva wrote:
>
> > Hi
> >
> > Thanks for the note. I just happened to see something strange. As I have
> > configured 3 Virtual hosts, in the <jboss home>/server/default/work
> > folder i can see the folders of each virtual host. Within each i can see
> > all the hosted apps including localhost.
> >
> > The folder <jboss home>/server/default/work contains webapp1.domain.com<http://webapp1.domain.com>
> ,
> > webapp2.domain.com <http://webapp2.domain.com> and webapp3.domain.com<http://webapp3.domain.com>
> >
> > The folder <jboss home>/server/default/work/webapp1.domain.com contains
> > webapp1, webapp2, webapp3 and jmx-console.
> >
> > The folder <jboss home>/server/default/work/webapp2.domain.com contains
> > webapp1, webapp2, webapp3 and jmx-console.
> >
> > The folder <jboss home>/server/default/work/webapp3.domain.com contains
> > webapp1, webapp2, webapp3 and jmx-console.
> >
> > Within each of these there are two files session and cache.
> >
> > Is this causing the issue.??? Is this normal ???
> >
> > Regards & Thanks
> > ================
> > Mahesh S Kudva
> >
> >
> > -----Original Message-----
> > From: Tim Funk <fu...@joedog.org>
> > To: Tomcat Users List <to...@jakarta.apache.org>
> > Date: Fri, 30 Sep 2005 11:55:18 -0400
> > Subject: Re: Multiple Threads for one webapp
> >
> >
> >>This still seems to be a programming issue (possibly a config issue).
> >>Without
> >>source and config files - I don't see how the mailing list can help
> >>resolve
> >>this.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>

Re: Multiple Threads for one webapp

Posted by sudip shrestha <su...@gmail.com>.
If you are using tomcat 5.5.x, you are not recommended to put <context>
element in the server.xml file according to the tomcat-docs...
so leaving the <host> element as it is, define this in a context-xml file
which should be in $tomcat-home/conf/Catalina/<host-name>/<app-name>.xml.
You can define your other Resource attributes such as jdbc connection pools
as such in here.
If you define your context in server.xml, tomcat creates another in the same
location thereby resulting in multiple context-deployments.

I had the similar problem earlier: I am using jdbc and ldap connection pools
and found that those resources were being initialized twice.

On 9/30/05, Tim Funk <fu...@joedog.org> wrote:
>
> I think JBOSS support (or mailing list) would be more helpful. Everything
> described below doesn't make any sense to those of us who don't use JBOSS.
>
> -Tim
>
> Mahesh S Kudva wrote:
>
> > Hi
> >
> > Thanks for the note. I just happened to see something strange. As I have
> > configured 3 Virtual hosts, in the <jboss home>/server/default/work
> > folder i can see the folders of each virtual host. Within each i can see
> > all the hosted apps including localhost.
> >
> > The folder <jboss home>/server/default/work contains webapp1.domain.com<http://webapp1.domain.com>
> ,
> > webapp2.domain.com <http://webapp2.domain.com> and webapp3.domain.com<http://webapp3.domain.com>
> >
> > The folder <jboss home>/server/default/work/webapp1.domain.com contains
> > webapp1, webapp2, webapp3 and jmx-console.
> >
> > The folder <jboss home>/server/default/work/webapp2.domain.com contains
> > webapp1, webapp2, webapp3 and jmx-console.
> >
> > The folder <jboss home>/server/default/work/webapp3.domain.com contains
> > webapp1, webapp2, webapp3 and jmx-console.
> >
> > Within each of these there are two files session and cache.
> >
> > Is this causing the issue.??? Is this normal ???
> >
> > Regards & Thanks
> > ================
> > Mahesh S Kudva
> >
> >
> > -----Original Message-----
> > From: Tim Funk <fu...@joedog.org>
> > To: Tomcat Users List <to...@jakarta.apache.org>
> > Date: Fri, 30 Sep 2005 11:55:18 -0400
> > Subject: Re: Multiple Threads for one webapp
> >
> >
> >>This still seems to be a programming issue (possibly a config issue).
> >>Without
> >>source and config files - I don't see how the mailing list can help
> >>resolve
> >>this.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>

Re: Multiple Threads for one webapp

Posted by Tim Funk <fu...@joedog.org>.
I think JBOSS support (or mailing list) would be more helpful. Everything 
described below doesn't make any sense to those of us who don't use JBOSS.

-Tim

Mahesh S Kudva wrote:

> Hi
> 
> Thanks for the note. I just happened to see something strange. As I have 
> configured 3 Virtual hosts, in the <jboss home>/server/default/work 
> folder i can see the folders of each virtual host. Within each i can see 
> all the hosted apps including localhost. 
> 
> The folder <jboss home>/server/default/work contains webapp1.domain.com, 
> webapp2.domain.com and webapp3.domain.com
> 
> The folder <jboss home>/server/default/work/webapp1.domain.com contains 
> webapp1, webapp2, webapp3 and jmx-console.
> 
> The folder <jboss home>/server/default/work/webapp2.domain.com contains 
> webapp1, webapp2, webapp3 and jmx-console.
> 
> The folder <jboss home>/server/default/work/webapp3.domain.com contains 
> webapp1, webapp2, webapp3 and jmx-console.
> 
> Within each of these there are two files session and cache. 
> 
> Is this causing the issue.??? Is this normal ???
> 
> Regards & Thanks
> ================
> Mahesh S Kudva
> 
> 
> -----Original Message-----
> From: Tim Funk <fu...@joedog.org>
> To: Tomcat Users List <to...@jakarta.apache.org>
> Date: Fri, 30 Sep 2005 11:55:18 -0400
> Subject: Re: Multiple Threads for one webapp
> 
> 
>>This still seems to be a programming issue (possibly a config issue).
>>Without 
>>source and config files - I don't see how the mailing list can help
>>resolve 
>>this.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Multiple Threads for one webapp

Posted by Mahesh S Kudva <ma...@robosoftin.com>.
Hi

Thanks for the note. I just happened to see something strange. As I have 
configured 3 Virtual hosts, in the <jboss home>/server/default/work 
folder i can see the folders of each virtual host. Within each i can see 
all the hosted apps including localhost. 

The folder <jboss home>/server/default/work contains webapp1.domain.com, 
webapp2.domain.com and webapp3.domain.com

The folder <jboss home>/server/default/work/webapp1.domain.com contains 
webapp1, webapp2, webapp3 and jmx-console.

The folder <jboss home>/server/default/work/webapp2.domain.com contains 
webapp1, webapp2, webapp3 and jmx-console.

The folder <jboss home>/server/default/work/webapp3.domain.com contains 
webapp1, webapp2, webapp3 and jmx-console.

Within each of these there are two files session and cache. 

Is this causing the issue.??? Is this normal ???

Regards & Thanks
================
Mahesh S Kudva


-----Original Message-----
From: Tim Funk <fu...@joedog.org>
To: Tomcat Users List <to...@jakarta.apache.org>
Date: Fri, 30 Sep 2005 11:55:18 -0400
Subject: Re: Multiple Threads for one webapp

> This still seems to be a programming issue (possibly a config issue).
> Without 
> source and config files - I don't see how the mailing list can help
> resolve 
> this.
> 
> -Tim
> 
> Mahesh S Kudva wrote:
> 
> > Hi
> > 
> > I have restarted Tomact and made sure no threads run in the
> background. 
> > But still the problem persists. Every time tomcat is restarted, I can
> see 
> > the notification thread start "Notification thread
> started.......32237"
> > 
> > 
> > 
> > Regards & Thanks
> > ================
> > Mahesh S Kudva
> > 
> > 
> > -----Original Message-----
> > From: Tim Funk <fu...@joedog.org>
> > To: Tomcat Users List <to...@jakarta.apache.org>
> > Date: Fri, 30 Sep 2005 09:56:09 -0400
> > Subject: Re: Multiple Threads for one webapp
> > 
> > 
> >>It seems you have a thread started in the background during the life
> of
> >>the 
> >>application.
> >>This thread goes to some external place of storage and to look for
> >>emails to 
> >>send.
> >>It seems this thread is not stopped when a context is reloaded.
> >>When the app is reloaded - a new thread is started.
> >>In this case - the app was restarted 6 times - leaving you 7 threads
> >>all 
> >>looking to the smae external loctation for sending emails.
> >>
> >>Solution: Use a ServletContextListerner to detect webapp shutdown so
> >>the 
> >>thread may be stopped.
> >>
> >>
> >>-Tim
> >>
> >>Mahesh S Kudva wrote:
> >>
> >>
> >>>Hi All
> >>> 
> >>> I have setup virtual hosts for 3 apps with virtual hosts config as 
> >>> follows. These virtual hosts are first handled by Apache and
> mod_jk.
> >>
> >>My 
> >>
> >>> apps have scheduler and automated mailing services.
> >>> 
> >>> <Host name="vhost.domain.com" debug="0" appBase=”deploy” 
> >>>unpackWARs="true">
> >>>         <Alias>www.vhost.domain.com</Alias>
> >>>         <Logger className="org.apache.catalina.logger.FileLogger"
> >>>             directory="${jboss.server.home.dir}/log" 
> >>>prefix="vhost_log1."  suffix=".log" timestamp="true"/>
> >>>          <Context path="" 
> >>> docBase="${jboss.server.home.dir}/deploy/application.war" debug="0"
> >>> reloadable="true"/>
> >>> </Host>
> >>> 
> >>>This config is mailing the same mail 7 time. Further I noticed that 
> >>>there  were 7 service started of the same kind. Querying the
> >>
> >>developer, 
> >>
> >>>he said that he had coded the apps to have the mail sent once every
> >>
> >>week. 
> >>
> >>>The mails are sent once every week but as said 7 copies of the same
> >>
> >>mail 
> >>
> >>>is delivered.
> >>> 
> >>> The request for the app results in page not found if I follow the 
> >>> following config, even thought there is no error in startup.
> >>> 
> >>> <Context path="application" 
> >>> docBase="${jboss.server.home.dir}/deploy/application.war" debug="0"
> >>> reloadable="true"/>
> >>> 
> >>> 
> >>> 
> >>> Can you guys have any idea on this and help me troubleshoot ???
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


-------------------------------------------------------
Robosoft Technologies - Partners in Product Development


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Multiple Threads for one webapp

Posted by Tim Funk <fu...@joedog.org>.
This still seems to be a programming issue (possibly a config issue). Without 
source and config files - I don't see how the mailing list can help resolve 
this.

-Tim

Mahesh S Kudva wrote:

> Hi
> 
> I have restarted Tomact and made sure no threads run in the background. 
> But still the problem persists. Every time tomcat is restarted, I can see 
> the notification thread start "Notification thread started.......32237"
> 
> 
> 
> Regards & Thanks
> ================
> Mahesh S Kudva
> 
> 
> -----Original Message-----
> From: Tim Funk <fu...@joedog.org>
> To: Tomcat Users List <to...@jakarta.apache.org>
> Date: Fri, 30 Sep 2005 09:56:09 -0400
> Subject: Re: Multiple Threads for one webapp
> 
> 
>>It seems you have a thread started in the background during the life of
>>the 
>>application.
>>This thread goes to some external place of storage and to look for
>>emails to 
>>send.
>>It seems this thread is not stopped when a context is reloaded.
>>When the app is reloaded - a new thread is started.
>>In this case - the app was restarted 6 times - leaving you 7 threads
>>all 
>>looking to the smae external loctation for sending emails.
>>
>>Solution: Use a ServletContextListerner to detect webapp shutdown so
>>the 
>>thread may be stopped.
>>
>>
>>-Tim
>>
>>Mahesh S Kudva wrote:
>>
>>
>>>Hi All
>>> 
>>> I have setup virtual hosts for 3 apps with virtual hosts config as 
>>> follows. These virtual hosts are first handled by Apache and mod_jk.
>>
>>My 
>>
>>> apps have scheduler and automated mailing services.
>>> 
>>> <Host name="vhost.domain.com" debug="0" appBase=”deploy” 
>>>unpackWARs="true">
>>>         <Alias>www.vhost.domain.com</Alias>
>>>         <Logger className="org.apache.catalina.logger.FileLogger"
>>>             directory="${jboss.server.home.dir}/log" 
>>>prefix="vhost_log1."  suffix=".log" timestamp="true"/>
>>>          <Context path="" 
>>> docBase="${jboss.server.home.dir}/deploy/application.war" debug="0" 
>>> reloadable="true"/>
>>> </Host>
>>> 
>>>This config is mailing the same mail 7 time. Further I noticed that 
>>>there  were 7 service started of the same kind. Querying the
>>
>>developer, 
>>
>>>he said that he had coded the apps to have the mail sent once every
>>
>>week. 
>>
>>>The mails are sent once every week but as said 7 copies of the same
>>
>>mail 
>>
>>>is delivered.
>>> 
>>> The request for the app results in page not found if I follow the 
>>> following config, even thought there is no error in startup.
>>> 
>>> <Context path="application" 
>>> docBase="${jboss.server.home.dir}/deploy/application.war" debug="0" 
>>> reloadable="true"/>
>>> 
>>> 
>>> 
>>> Can you guys have any idea on this and help me troubleshoot ???


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Multiple Threads for one webapp

Posted by Mahesh S Kudva <ma...@robosoftin.com>.
Hi

I have restarted Tomact and made sure no threads run in the background. 
But still the problem persists. Every time tomcat is restarted, I can see 
the notification thread start "Notification thread started.......32237"



Regards & Thanks
================
Mahesh S Kudva


-----Original Message-----
From: Tim Funk <fu...@joedog.org>
To: Tomcat Users List <to...@jakarta.apache.org>
Date: Fri, 30 Sep 2005 09:56:09 -0400
Subject: Re: Multiple Threads for one webapp

> It seems you have a thread started in the background during the life of
> the 
> application.
> This thread goes to some external place of storage and to look for
> emails to 
> send.
> It seems this thread is not stopped when a context is reloaded.
> When the app is reloaded - a new thread is started.
> In this case - the app was restarted 6 times - leaving you 7 threads
> all 
> looking to the smae external loctation for sending emails.
> 
> Solution: Use a ServletContextListerner to detect webapp shutdown so
> the 
> thread may be stopped.
> 
> 
> -Tim
> 
> Mahesh S Kudva wrote:
> 
> > Hi All
> >  
> >  I have setup virtual hosts for 3 apps with virtual hosts config as 
> >  follows. These virtual hosts are first handled by Apache and mod_jk.
> My 
> >  apps have scheduler and automated mailing services.
> >  
> >  <Host name="vhost.domain.com" debug="0" appBase=”deploy” 
> > unpackWARs="true">
> >          <Alias>www.vhost.domain.com</Alias>
> >          <Logger className="org.apache.catalina.logger.FileLogger"
> >              directory="${jboss.server.home.dir}/log" 
> > prefix="vhost_log1."  suffix=".log" timestamp="true"/>
> >           <Context path="" 
> >  docBase="${jboss.server.home.dir}/deploy/application.war" debug="0" 
> >  reloadable="true"/>
> >  </Host>
> >  
> > This config is mailing the same mail 7 time. Further I noticed that 
> > there  were 7 service started of the same kind. Querying the
> developer, 
> > he said that he had coded the apps to have the mail sent once every
> week. 
> > The mails are sent once every week but as said 7 copies of the same
> mail 
> > is delivered.
> >  
> >  The request for the app results in page not found if I follow the 
> >  following config, even thought there is no error in startup.
> >  
> >  <Context path="application" 
> >  docBase="${jboss.server.home.dir}/deploy/application.war" debug="0" 
> >  reloadable="true"/>
> >  
> >  
> >  
> >  Can you guys have any idea on this and help me troubleshoot ???
> >  
> >  
> >  Regards & Thanks
> >  ================
> >  Mahesh S Kudva
> > 
> > 
> > -------------------------------------------------------
> > Robosoft Technologies - Partners in Product Development
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


-------------------------------------------------------
Robosoft Technologies - Partners in Product Development


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org