• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ContextListener starting twice

 
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a very simple context listener that just sets a context variable at initialization. The action is here:

Note the "log.write" at the very end. In addition, the dbUtils constructor has a print statement. Here is the deployment descriptor from the web.xml (and I did a search to make sure it is the only one):

When this listener is run at initialization, here is what I get in the log file:


SEVERE: No Store configured, persistence disabled

************
dbConPoolListener::ContextInitialized
Jun 23 16:40:45: Got db name: infoisland

Initializing dbUtils with sc; sc, ds= org.apache.catalina.core.ApplicationContextFacade@ed662d null
Jun 23 16:40:45: dbUtils::initPool
Jun 23 16:40:45: dbConPoolListener::Seems to have run OK
******************

Jun 23, 2007 4:40:45 PM org.apache.catalina.session.PersistentManagerBase start
SEVERE: No Store configured, persistence disabled

************
dbConPoolListener::ContextInitialized
Jun 23 16:40:45: Got db name: infoisland

Initializing dbUtils with sc; sc, ds= org.apache.catalina.core.ApplicationContextFacade@b122a1 null
Jun 23 16:40:45: dbUtils::initPool
Jun 23 16:40:45: dbConPoolListener::Seems to have run OK
*******************

Jun 23, 2007 4:40:46 PM org.apache.coyote.http11.Http11BaseProtocol start


In other words, it looks like it is running twice. Any ideas why this would be? In my server.xml, I do have two Contexts with the same docbase. Is that what's causing this?

TIA,
anw
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, yeah. Two contexts means two web apps.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A typical cause for this is an app that is both configured in either server.xml or with a context fragment; and that is located in the tomcat/webapps directory (where it will be auto deployed).
reply
    Bookmark Topic Watch Topic
  • New Topic