Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2007

Tip: Looking for answers? Try searching our database.

Tomcat 6 is loading context twice

Thread view: 
christopher@dailycrossword.com - 23 Jun 2007 23:46 GMT
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.
christopher@dailycrossword.com - 23 Jun 2007 23:58 GMT
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!

On Jun 23, 3:46 pm, christop...@dailycrossword.com wrote:
> Greetings!
>
[quoted text clipped - 101 lines]
> there are some spurious <host> tags added my my isp (damn them!) and
> one had a context path, of that matters.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.