tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filip Hanik - Dev Lists <devli...@hanik.com>
Subject Re: Connection pool race condition
Date Thu, 28 Apr 2011 18:58:52 GMT
this is the way to go, just setup a service dependency



On 4/28/2011 7:36 AM, Peter Crowther wrote:
> You could use Windows' service dependency management (
> http://support.microsoft.com/kb/193888) to start Tomcat only after Oracle
> reports that it's running.  This might still cause problems if Oracle does
> the same as SQL Server and continues recovering after its "official" startup
> has finished.  In that case, I'd try to write a small service that polled
> Oracle every few seconds till it started, then reported itself as started,
> and make Tomcat dependent on that.  Service creation in Windows isn't too
> hard, but it's another moving part to support!
>
> - Peter
>
> On 27 April 2011 21:18, chris derham<chris@derham.me.uk>  wrote:
>
>> All,
>>
>> So we have various tomcat services setup on windows. When windows updates
>> are auto installed, sometimes they force a reboot of the server. When this
>> happens, the tomcats win the race with the database (Oracle) to startup.
>> Then the connection pool can't start, and then the war file is flagged as
>> shutdown. We have tried to make the tomcat services dependent on the oracle
>> service (both db service and tns listener), but same happens. Just tried to
>> turn the connection pool initial size down to zero, but the app fetches
>> some
>> config at startup. I guess we could recode to lazily fetch this upon first
>> access. Just curious if anyone has hit this, and if there is a way to delay
>> the tomcat service startup.
>>
>> Tomcat 7.0.12
>> Windows server 2008 r2 64 bit
>>
>>> java -version
>> java version "1.6.0_24"
>> Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
>> Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)
>>
>> We have connection pool setup in catalina_base\conf\context.xml
>>
>>     <Resource name="jdbc/xts"
>>             auth="Container"
>>             type="javax.sql.DataSource"
>>             username="username"
>>             password="password"
>>             driverClassName="oracle.jdbc.OracleDriver"
>>             url="jdbc:oracle:thin:@localhost:1521:xe"
>>             maxActive="20"
>>             maxIdle="2"
>>             minIdle="1"
>>             initialSize="2"
>>             />
>>
>>
>> 27-Apr-2011 19:48:22 org.apache.catalina.core.ApplicationContext log
>> INFO: Initializing Spring root WebApplicationContext
>> 27-Apr-2011 19:48:31 org.apache.catalina.core.ApplicationContext log
>> INFO: Initializing Spring FrameworkServlet 'dispatcher'
>> 27-Apr-2011 20:21:22 org.apache.catalina.core.ApplicationContext log
>> INFO: Destroying Spring FrameworkServlet 'dispatcher'
>> 27-Apr-2011 20:21:22 org.apache.catalina.core.ApplicationContext log
>> INFO: Closing Spring root WebApplicationContext
>> 27-Apr-2011 20:21:22 org.apache.catalina.core.ApplicationContext log
>> INFO: Shutting down log4j
>> 27-Apr-2011 20:25:36 org.apache.catalina.core.StandardContext listenerStart
>> SEVERE: Exception sending context initialized event to listener instance of
>> class liquibase.integration.servlet.LiquibaseServletListener
>> java.lang.RuntimeException: javax.naming.NamingException: Cannot create
>> PoolableConnectionFactory (ORA-01033: ORACLE initialization or shutdown in
>> progress
>> )
>>     at
>>
>> liquibase.integration.servlet.LiquibaseServletListener.contextInitialized(LiquibaseServletListener.java:159)
>>     at
>>
>> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4701)
>>     at
>> org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5204)
>>     at
>> org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5199)
>>     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>>     at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>>     at
>>
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>     at
>>
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>     at java.lang.Thread.run(Thread.java:662)
>> Caused by: javax.naming.NamingException: Cannot create
>> PoolableConnectionFactory (ORA-01033: ORACLE initialization or shutdown in
>> progress
>> )
>>     at org.apache.naming.NamingContext.lookup(NamingContext.java:843)
>>     at org.apache.naming.NamingContext.lookup(NamingContext.java:145)
>>     at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
>>     at org.apache.naming.NamingContext.lookup(NamingContext.java:145)
>>     at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
>>     at org.apache.naming.NamingContext.lookup(NamingContext.java:145)
>>     at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
>>     at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
>>     at org.apache.naming.SelectorContext.lookup(SelectorContext.java:158)
>>     at javax.naming.InitialContext.lookup(InitialContext.java:392)
>>
>> Thanks
>>
>> Chris
>>
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 10.0.1209 / Virus Database: 1500/3601 - Release Date: 04/27/11


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message