tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cox, Charlie" <c...@cincom.com>
Subject RE: Multiple serlvet contexts being created instead of 1
Date Thu, 16 Jan 2003 14:50:17 GMT
it will create one context for each <context> in server.xml. So if you have
it defined under 'Standalone' and also under 'Warp', then you will have
mutiple instances, but if you only use Warp, then it will only use one of
those instances.

Also note that it autoloads any context located under your appBase for the
<host>. To disable this, set the appBase=<some empty dir>

Charlie

> -----Original Message-----
> From: David Hemingway [mailto:dhemingway@datafast.net.au]
> Sent: Tuesday, January 14, 2003 7:26 AM
> To: Tomcat Users List
> Subject: Multiple serlvet contexts being created instead of 1
> 
> 
> Hi,
> 
> I still have the problem of not getting a singleton class to 
> in fact be a singleton (its configured as a context listener 
> inside web.xml). Some people suggested that perhaps i was 
> getting more than 1 instance of the web app being created and 
> that seems to be the case. My context si configured in my 
> server.xml and the location of the webapp is not in tomcat's 
> standard webapp directory. The follwoing 3 stack traces are 
> basically a time line from when the server starts.
> 
> I threw some dummy, caught exceptions in my code so I could 
> see the stack trace.
> 
> --------------------------
> --> Server starts here <--
> --------------------------
> 
> 1st instance of the task scheduler listener (on server start 
> as expected)
> 
> Context Initialized
> The Servlet Context is 
> org.apache.catalina.core.ApplicationContext@238a47
> New Scheduler Created
> java.lang.Exception: Testing
>         at com.lawonline.Scheduler.getScheduler(Scheduler.java:43)
>         at 
> com.lawonline.StartServlet.contextInitialized(StartServlet.java:37)
>         at 
> org.apache.catalina.core.StandardContext.listenerStart(Standar
dContext.java:3269)
>         at 
> org.apache.catalina.core.StandardContext.start(StandardContext
> .java:3598)
>         at 
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
>         at 
> org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
>         at 
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
>         at 
> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
>         at 
> org.apache.catalina.core.StandardService.start(StandardService
> .java:497)
>         at 
> org.apache.catalina.core.StandardServer.start(StandardServer.j
> ava:2189)
>         at 
> org.apache.catalina.startup.Catalina.start(Catalina.java:512)
>         at 
> org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
>         at 
> org.apache.catalina.startup.Catalina.process(Catalina.java:180)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccess
> orImpl.java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
odAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at 
> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
>         
> 
> ----------------------------------------------------------------------
> --> First request of a jsp (to any page  in the webapp) <--
> ----------------------------------------------------------------------
> 
> 2nd instance (created from the warp connector)
> 
> Context Initialized
> The Servlet Context is 
> org.apache.catalina.core.ApplicationContext@11db6bb
> New Scheduler Created
> java.lang.Exception: Testing
>         at com.lawonline.Scheduler.getScheduler(Scheduler.java:43)
>         at 
> com.lawonline.StartServlet.contextInitialized(StartServlet.java:37)
>         at 
> org.apache.catalina.core.StandardContext.listenerStart(Standar
dContext.java:3269)
>         at 
> org.apache.catalina.core.StandardContext.start(StandardContext
> .java:3598)
>         at 
> org.apache.catalina.core.ContainerBase.addChildInternal(Contai
nerBase.java:821)
>         at 
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.
> java:807)
>         at 
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)
>         at 
> org.apache.catalina.core.StandardHostDeployer.install(Standard
HostDeployer.java:257)
>         at 
> org.apache.catalina.core.StandardHost.install(StandardHost.java:772)
>         at 
> org.apache.catalina.connector.warp.WarpConfigurationHandler.de
> ploy(Unknown Source)
>         at 
> org.apache.catalina.connector.warp.WarpConfigurationHandler.ha
> ndle(Unknown Source)
>         at 
> org.apache.catalina.connector.warp.WarpConnection.run(Unknown Source)
>         at java.lang.Thread.run(Thread.java:536)
> The listener is: com.lawonline.StartServlet@157ea4a
> 
> 
> 3rd (also created from the warp connector)
> 
> Context Initialized
> The Servlet Context is 
> org.apache.catalina.core.ApplicationContext@1568fb5
> New Scheduler Created
> java.lang.Exception: Testing
>         at com.lawonline.Scheduler.getScheduler(Scheduler.java:43)
>         at 
> com.lawonline.StartServlet.contextInitialized(StartServlet.java:37)
>         at 
> org.apache.catalina.core.StandardContext.listenerStart(Standar
dContext.java:3269)
>         at 
> org.apache.catalina.core.StandardContext.start(StandardContext
> .java:3598)
>         at 
> org.apache.catalina.core.ContainerBase.addChildInternal(Contai
nerBase.java:821)
>         at 
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.
> java:807)
>         at 
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)
>         at 
> org.apache.catalina.core.StandardHostDeployer.install(Standard
HostDeployer.java:257)
>         at 
> org.apache.catalina.core.StandardHost.install(StandardHost.java:772)
>         at 
> org.apache.catalina.connector.warp.WarpConfigurationHandler.de
> ploy(Unknown Source)
>         at 
> org.apache.catalina.connector.warp.WarpConfigurationHandler.ha
> ndle(Unknown Source)
>         at 
> org.apache.catalina.connector.warp.WarpConnection.run(Unknown Source)
>         at java.lang.Thread.run(Thread.java:536)
> The listener is: com.lawonline.StartServlet@a4488
> Got Scheduler Instance
> 
> 
> Why would the warp connector create a new context after the 
> server start already created one? Why on earth would it 
> create 2? The old ones never die, there is 3 independent 
> ServletContexts continually running from this point forth.
> 
> I assume that this problem must be in Apache's config or in 
> the connectors somewhere (or possibly a bug?)... It must be 
> resolved for my application to function correctly. Any ideas 
> from anyone would be greatly appreciated. What are the main 
> differences between WARP and AJP ? .... Thanks
> 
> regards,
> Dave
> 
> 
> 
> 

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


Mime
View raw message