Tomcat 6 is loading context twice

C

christopher

Greetings!

I edited the ContextListener.java file in a single webapp (class
files, no war) to launch a singleton and make a small addition to the
logs like this:

public void contextInitialized(ServletContextEvent event) {

this.context = event.getServletContext();
Updater.getInstance().launchThread();
log("mysite contextInitialized()"); //
<< added "mysite" only to this webapp
}

I shut down tomcat, removed the stdout.log (used to be catalina.log)
and restarted tomcat to get a 'pristine' log.

You can clearly see two "INFO: ContextListener: mysite
contextInitialized()", two singletons, two threads, etc.

What would cause this behavior?

Thanx!
-- clh


~~~~~~~~~~
stdout.log (entire):
Jun 23, 2007 3:25:44 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jun 23, 2007 3:25:44 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 941 ms
Jun 23, 2007 3:25:44 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jun 23, 2007 3:25:44 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
Jun 23, 2007 3:25:46 PM org.apache.catalina.core.ApplicationContext
log
INFO: ContextListener: contextInitialized()
Jun 23, 2007 3:25:46 PM org.apache.catalina.core.ApplicationContext
log
INFO: SessionListener: contextInitialized()
Updater() constructor.
UpdaterThread constructor
mysiteGlobals constructor()
->->mysiteGlobals ready: true
mysiteGlobals.isReady() 1? false Thread[Thread-1,5,main]
Jun 23, 2007 3:25:47 PM org.apache.catalina.core.ApplicationContext
log
INFO: ContextListener: mysite contextInitialized()
Jun 23, 2007 3:25:47 PM org.apache.catalina.core.ApplicationContext
log
INFO: SessionListener: contextInitialized()
Jun 23, 2007 3:25:48 PM org.apache.catalina.core.ApplicationContext
log
INFO: ContextListener: contextInitialized()
Jun 23, 2007 3:25:48 PM org.apache.catalina.core.ApplicationContext
log
INFO: SessionListener: contextInitialized()
mysiteGlobals.isReady() 2? false Thread[Thread-1,5,main]
Updater() constructor.
UpdaterThread constructor
mysiteGlobals constructor()
->->mysiteGlobals ready: true
Jun 23, 2007 3:25:48 PM org.apache.catalina.core.ApplicationContext
log
INFO: ContextListener: mysite contextInitialized()
Jun 23, 2007 3:25:48 PM org.apache.catalina.core.ApplicationContext
log
INFO: SessionListener: contextInitialized()
mysiteGlobals.isReady() 1? false Thread[Thread-4,5,main]
Jun 23, 2007 3:25:48 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jun 23, 2007 3:25:48 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Jun 23, 2007 3:25:48 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/43 config=null
Jun 23, 2007 3:25:48 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 4558 ms
mysiteGlobals.isReady() 2? false Thread[Thread-4,5,main]
mysiteGlobals.isReady() 3? false Thread[Thread-1,5,main]
spgame.Updater@933bcb
mysiteGlobals.isReady() 3? false Thread[Thread-4,5,main]
spgame.Updater@aa233f
~~~~~~~~~~~
web.xml from webapp (snippet):
<!-- Define example application events listeners -->^M
<listener>^M
<listener-class>listeners.ContextListener</listener-class>^M
</listener>^M
<listener>^M
<listener-class>listeners.SessionListener</listener-class>^M
</listener>^M
~~~~~~~~~~~~
context.xml (entire)
<Context reloadable="true">
<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<!-- Uncomment this to disable session persistence across Tomcat
restarts --
<Manager pathname="" />
</Context>
~~~~~~~~~~~~~~~~
server.xml
there are some spurious <host> tags added my my isp (damn them!) and
one had a context path, of that matters.
 
C

christopher

Sonofagun
All I did to fix this was copy the server.xml.sample file to
server.xml. Something bizarre my isp did in their tomcat config
caused this issue.

Thanx anyway!


Greetings!

I edited the ContextListener.java file in a single webapp (class
files, no war) to launch a singleton and make a small addition to the
logs like this:

public void contextInitialized(ServletContextEvent event) {

this.context = event.getServletContext();
Updater.getInstance().launchThread();
log("mysite contextInitialized()"); //
<< added "mysite" only to this webapp
}

I shut down tomcat, removed the stdout.log (used to be catalina.log)
and restarted tomcat to get a 'pristine' log.

You can clearly see two "INFO: ContextListener: mysite
contextInitialized()", two singletons, two threads, etc.

What would cause this behavior?

Thanx!
-- clh

~~~~~~~~~~
stdout.log (entire):
Jun 23, 2007 3:25:44 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jun 23, 2007 3:25:44 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 941 ms
Jun 23, 2007 3:25:44 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jun 23, 2007 3:25:44 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
Jun 23, 2007 3:25:46 PM org.apache.catalina.core.ApplicationContext
log
INFO: ContextListener: contextInitialized()
Jun 23, 2007 3:25:46 PM org.apache.catalina.core.ApplicationContext
log
INFO: SessionListener: contextInitialized()
Updater() constructor.
UpdaterThread constructor
mysiteGlobals constructor()
->->mysiteGlobals ready: true
mysiteGlobals.isReady() 1? false Thread[Thread-1,5,main]
Jun 23, 2007 3:25:47 PM org.apache.catalina.core.ApplicationContext
log
INFO: ContextListener: mysite contextInitialized()
Jun 23, 2007 3:25:47 PM org.apache.catalina.core.ApplicationContext
log
INFO: SessionListener: contextInitialized()
Jun 23, 2007 3:25:48 PM org.apache.catalina.core.ApplicationContext
log
INFO: ContextListener: contextInitialized()
Jun 23, 2007 3:25:48 PM org.apache.catalina.core.ApplicationContext
log
INFO: SessionListener: contextInitialized()
mysiteGlobals.isReady() 2? false Thread[Thread-1,5,main]
Updater() constructor.
UpdaterThread constructor
mysiteGlobals constructor()
->->mysiteGlobals ready: true
Jun 23, 2007 3:25:48 PM org.apache.catalina.core.ApplicationContext
log
INFO: ContextListener: mysite contextInitialized()
Jun 23, 2007 3:25:48 PM org.apache.catalina.core.ApplicationContext
log
INFO: SessionListener: contextInitialized()
mysiteGlobals.isReady() 1? false Thread[Thread-4,5,main]
Jun 23, 2007 3:25:48 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jun 23, 2007 3:25:48 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Jun 23, 2007 3:25:48 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/43 config=null
Jun 23, 2007 3:25:48 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 4558 ms
mysiteGlobals.isReady() 2? false Thread[Thread-4,5,main]
mysiteGlobals.isReady() 3? false Thread[Thread-1,5,main]
spgame.Updater@933bcb
mysiteGlobals.isReady() 3? false Thread[Thread-4,5,main]
spgame.Updater@aa233f
~~~~~~~~~~~
web.xml from webapp (snippet):
<!-- Define example application events listeners -->^M
<listener>^M
<listener-class>listeners.ContextListener</listener-class>^M
</listener>^M
<listener>^M
<listener-class>listeners.SessionListener</listener-class>^M
</listener>^M
~~~~~~~~~~~~
context.xml (entire)
<Context reloadable="true">
<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<!-- Uncomment this to disable session persistence across Tomcat
restarts --
<Manager pathname="" />
</Context>
~~~~~~~~~~~~~~~~
server.xml
there are some spurious <host> tags added my my isp (damn them!) and
one had a context path, of that matters.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top