You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Stein, Eric" <st...@locustec.com> on 2012/06/12 14:24:38 UTC

FW: Quartz falling down on database restart

Sorry if this is a duplicate .. my email server was acting up yesterday
so I don't know if this went through.

Eric

-----Original Message-----
From: Stein, Eric 
Sent: Monday, June 11, 2012 4:58 PM
To: users@tomcat.apache.org
Subject: Quartz falling down on database restart

I'm running a Quartz application in Tomcat 6.0.33. When my database
bounces, Quartz starts throwing exceptions every time it tries a
database operation. The common cause is:

    Caused by: java.sql.SQLException: Invalid state, the Connection
object is closed.  
        at
net.sourceforge.jtds.jdbc.ConnectionJDBC2.checkOpen(ConnectionJDBC2.java
:1713) ~[jtds-1.2.4.jar:1.2.4]  
        at
net.sourceforge.jtds.jdbc.ConnectionJDBC2.prepareStatement(ConnectionJDB
C2.java:2412) ~[jtds-1.2.4.jar:1.2.4]  
        at sun.reflect.GeneratedMethodAccessor34.invoke(Unknown Source)
~[na:na]  
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25) ~[na:1.6.0_23]  
        at java.lang.reflect.Method.invoke(Method.java:597)
~[na:1.6.0_23]  
        at
org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:
126) ~[tomcat-jdbc.jar:na]  
        at $Proxy0.prepareStatement(Unknown Source) ~[na:na]  
        at sun.reflect.GeneratedMethodAccessor46.invoke(Unknown Source)
~[na:na]  
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25) ~[na:1.6.0_23]  
        at java.lang.reflect.Method.invoke(Method.java:597)
~[na:1.6.0_23]  
        at
org.quartz.impl.jdbcjobstore.AttributeRestoringConnectionInvocationHandl
er.invoke(AttributeRestoringConnectionInvocationHandler.java:73)
~[quartz-2.1.5.jar:na]  
        at $Proxy10.prepareStatement(Unknown Source) ~[na:na]  
        at
org.quartz.impl.jdbcjobstore.StdJDBCDelegate.countMisfiredTriggersInStat
e(StdJDBCDelegate.java:413) ~[quartz-2.1.5.jar:na]  
        at
org.quartz.impl.jdbcjobstore.JobStoreSupport.doRecoverMisfires(JobStoreS
upport.java:3176) ~[quartz-2.1.5.jar:na]  
        ... 2 common frames omitted  



In my [CATALINA_HOME]/conf/context.xml file, I've configured the
datasource that Quartz is using:

         <Resource name="jdbc/MyResource"  
                   auth="Container"  
 
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"  
                   type="javax.sql.DataSource"   
                   driverClassName="net.sourceforge.jtds.jdbc.Driver"  
 
url="jdbc:jtds:sqlserver://ms-sql-database:1433/MyDatabase"  
                   username="some_user"   
                   password="some_password"   
                   maxActive="20"   
                   maxIdle="10"  
                   maxWait="-1"  
                   validationQuery="select 1" />  



I was told on the Quartz forum that the validationQuery was what quartz
used "to trigger recovery of the connections", but that isn't happening.
Is there some other tomcat-side configuration that I need for the
validation queries? Alternately, is there some way to figure out what's
going on?

Thanks,
Eric Stein

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


Re: Quartz falling down on database restart

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Eric,

On 6/12/12 9:27 AM, Stein, Eric wrote:
> I don't explicitly set testOnBorrow, and it defaults to true. I did
> just notice, however, that I'm using 
> org.apache.tomcat.jdbc.pool.DataSourceFactory. Is that valid for
> Tomcat 6.0.33? I'm going to try changing Tomcat to use DBCP and see
> if that helps.

You shouldn't really have to specify the factory unless you are really
intent on using a specific one. If you are okay with the default, then
remove the explicit reference to it -- just in case Tomcat decides to
change the default.

Can you paste the entire stack trace? I don't see any use of the DBCP
in there.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk/XTtkACgkQ9CaO5/Lv0PA7cACgkgwFlCrrnx8nN22GDi5u/ycE
SKkAn3+s0hUlEZURimPYfZv1sm3ZlNl/
=rvtM
-----END PGP SIGNATURE-----

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


RE: Quartz falling down on database restart

Posted by "Stein, Eric" <st...@locustec.com>.
I don't explicitly set testOnBorrow, and it defaults to true.
I did just notice, however, that I'm using
org.apache.tomcat.jdbc.pool.DataSourceFactory. Is that valid for Tomcat
6.0.33? I'm going to try changing Tomcat to use DBCP and see if that
helps.

Eric

-----Original Message-----
From: Hedrick, Brooke - 43 [mailto:brooke.hedrick@rainhail.com] 
Sent: Tuesday, June 12, 2012 9:08 AM
To: users@tomcat.apache.org
Subject: RE: Quartz falling down on database restart


> -----Original Message-----
> From: Stein, Eric [mailto:steine@locustec.com]
> Sent: Tuesday, June 12, 2012 7:25 AM
> To: users@tomcat.apache.org
> Subject: FW: Quartz falling down on database restart
> 
> Sorry if this is a duplicate .. my email server was acting up 
> yesterday so I don't know if this went through.
> 
> Eric
> 
> -----Original Message-----
> From: Stein, Eric
> Sent: Monday, June 11, 2012 4:58 PM
> To: users@tomcat.apache.org
> Subject: Quartz falling down on database restart
> 
> I'm running a Quartz application in Tomcat 6.0.33. When my database 
> bounces, Quartz starts throwing exceptions every time it tries a 
> database operation. The common cause is:
> 
>     Caused by: java.sql.SQLException: Invalid state, the Connection 
> object is closed.
>         at
> net.sourceforge.jtds.jdbc.ConnectionJDBC2.checkOpen(ConnectionJDBC2.ja
> va
> :1713) ~[jtds-1.2.4.jar:1.2.4]
>         at
> net.sourceforge.jtds.jdbc.ConnectionJDBC2.prepareStatement(ConnectionJ
> DB
> C2.java:2412) ~[jtds-1.2.4.jar:1.2.4]
>         at sun.reflect.GeneratedMethodAccessor34.invoke(Unknown 
> Source) ~[na:na]
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sor
> Impl.java:25) ~[na:1.6.0_23]
>         at java.lang.reflect.Method.invoke(Method.java:597)
> ~[na:1.6.0_23]
>         at
> org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.jav
> a
> :
> 126) ~[tomcat-jdbc.jar:na]
>         at $Proxy0.prepareStatement(Unknown Source) ~[na:na]
>         at sun.reflect.GeneratedMethodAccessor46.invoke(Unknown 
> Source) ~[na:na]
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sor
> Impl.java:25) ~[na:1.6.0_23]
>         at java.lang.reflect.Method.invoke(Method.java:597)
> ~[na:1.6.0_23]
>         at
> org.quartz.impl.jdbcjobstore.AttributeRestoringConnectionInvocationHan
> dl
> er.invoke(AttributeRestoringConnectionInvocationHandler.java:73)
> ~[quartz-2.1.5.jar:na]
>         at $Proxy10.prepareStatement(Unknown Source) ~[na:na]
>         at
> org.quartz.impl.jdbcjobstore.StdJDBCDelegate.countMisfiredTriggersInSt
> at
> e(StdJDBCDelegate.java:413) ~[quartz-2.1.5.jar:na]
>         at
> org.quartz.impl.jdbcjobstore.JobStoreSupport.doRecoverMisfires(JobStor
> eS
> upport.java:3176) ~[quartz-2.1.5.jar:na]
>         ... 2 common frames omitted
> 
> 
> 
> In my [CATALINA_HOME]/conf/context.xml file, I've configured the 
> datasource that Quartz is using:
> 
>          <Resource name="jdbc/MyResource"
>                    auth="Container"
> 
> factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
>                    type="javax.sql.DataSource"
>                    driverClassName="net.sourceforge.jtds.jdbc.Driver"
> 
> url="jdbc:jtds:sqlserver://ms-sql-database:1433/MyDatabase"
>                    username="some_user"
>                    password="some_password"
>                    maxActive="20"
>                    maxIdle="10"
>                    maxWait="-1"
>                    validationQuery="select 1" />
> 

Eric, is testOnBorrow set to true?

-Brooke Hedrick

> 
> 
> I was told on the Quartz forum that the validationQuery was what 
> quartz used "to trigger recovery of the connections", but that isn't
happening.
> Is there some other tomcat-side configuration that I need for the 
> validation queries? Alternately, is there some way to figure out
what's going on?
> 
> Thanks,
> Eric Stein
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org


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


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


RE: Quartz falling down on database restart

Posted by "Hedrick, Brooke - 43" <br...@rainhail.com>.
> -----Original Message-----
> From: Stein, Eric [mailto:steine@locustec.com]
> Sent: Tuesday, June 12, 2012 7:25 AM
> To: users@tomcat.apache.org
> Subject: FW: Quartz falling down on database restart
> 
> Sorry if this is a duplicate .. my email server was acting up yesterday so I don't
> know if this went through.
> 
> Eric
> 
> -----Original Message-----
> From: Stein, Eric
> Sent: Monday, June 11, 2012 4:58 PM
> To: users@tomcat.apache.org
> Subject: Quartz falling down on database restart
> 
> I'm running a Quartz application in Tomcat 6.0.33. When my database
> bounces, Quartz starts throwing exceptions every time it tries a database
> operation. The common cause is:
> 
>     Caused by: java.sql.SQLException: Invalid state, the Connection object is
> closed.
>         at
> net.sourceforge.jtds.jdbc.ConnectionJDBC2.checkOpen(ConnectionJDBC2.ja
> va
> :1713) ~[jtds-1.2.4.jar:1.2.4]
>         at
> net.sourceforge.jtds.jdbc.ConnectionJDBC2.prepareStatement(ConnectionJ
> DB
> C2.java:2412) ~[jtds-1.2.4.jar:1.2.4]
>         at sun.reflect.GeneratedMethodAccessor34.invoke(Unknown Source)
> ~[na:na]
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sor
> Impl.java:25) ~[na:1.6.0_23]
>         at java.lang.reflect.Method.invoke(Method.java:597)
> ~[na:1.6.0_23]
>         at
> org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java
> :
> 126) ~[tomcat-jdbc.jar:na]
>         at $Proxy0.prepareStatement(Unknown Source) ~[na:na]
>         at sun.reflect.GeneratedMethodAccessor46.invoke(Unknown Source)
> ~[na:na]
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sor
> Impl.java:25) ~[na:1.6.0_23]
>         at java.lang.reflect.Method.invoke(Method.java:597)
> ~[na:1.6.0_23]
>         at
> org.quartz.impl.jdbcjobstore.AttributeRestoringConnectionInvocationHandl
> er.invoke(AttributeRestoringConnectionInvocationHandler.java:73)
> ~[quartz-2.1.5.jar:na]
>         at $Proxy10.prepareStatement(Unknown Source) ~[na:na]
>         at
> org.quartz.impl.jdbcjobstore.StdJDBCDelegate.countMisfiredTriggersInStat
> e(StdJDBCDelegate.java:413) ~[quartz-2.1.5.jar:na]
>         at
> org.quartz.impl.jdbcjobstore.JobStoreSupport.doRecoverMisfires(JobStoreS
> upport.java:3176) ~[quartz-2.1.5.jar:na]
>         ... 2 common frames omitted
> 
> 
> 
> In my [CATALINA_HOME]/conf/context.xml file, I've configured the
> datasource that Quartz is using:
> 
>          <Resource name="jdbc/MyResource"
>                    auth="Container"
> 
> factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
>                    type="javax.sql.DataSource"
>                    driverClassName="net.sourceforge.jtds.jdbc.Driver"
> 
> url="jdbc:jtds:sqlserver://ms-sql-database:1433/MyDatabase"
>                    username="some_user"
>                    password="some_password"
>                    maxActive="20"
>                    maxIdle="10"
>                    maxWait="-1"
>                    validationQuery="select 1" />
> 

Eric, is testOnBorrow set to true?

-Brooke Hedrick

> 
> 
> I was told on the Quartz forum that the validationQuery was what quartz
> used "to trigger recovery of the connections", but that isn't happening.
> Is there some other tomcat-side configuration that I need for the validation
> queries? Alternately, is there some way to figure out what's going on?
> 
> Thanks,
> Eric Stein
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org


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