Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ContextListener starting twice

 
Allen Williams
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • 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
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64983
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, yeah. Two contexts means two web apps.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • 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).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic