org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'myDS': java.sql.SQLException: com.mchange.v2.c3p0.ComboPooledDataSource [ java.beans.IntrospectionException: java.lang.reflect.InvocationTargetException [lastAcquisitionFailureDefaultUser] ] has been closed() -- you can no longer use it. [See nested exception: java.sql.SQLException: com.mchange.v2.c3p0.ComboPooledDataSource [ java.beans.IntrospectionException: java.lang.reflect.InvocationTargetException [lastAcquisitionFailureDefaultUser] ] has been closed() -- you can no longer use it.]

Terracotta Project Issue Tracker | Steffen Ritter | 3 years ago
  1. 0

    There is the possibility that the scheduler is shutting down the jobstore while a job is still running. This should not happen if you shut down the scheduler with "sched.shutdown(true)", but it does. As a result, Quartz can't mark the job as "complete" although the WorkerThread will complete because of "shutdown(true)". If the job is marked for recovery it will be executed again (two times). Error output is as follows: {code:title=ErrorLog | borderStyle=solid} 17:35:22,440 ERROR [org.quartz.core.ErrorLogger] - An error occured while marking executed job complete. job= 'group_1.job_1' org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'myDS': java.sql.SQLException: com.mchange.v2.c3p0.ComboPooledDataSource [ java.beans.IntrospectionException: java.lang.reflect.InvocationTargetException [lastAcquisitionFailureDefaultUser] ] has been closed() -- you can no longer use it. [See nested exception: java.sql.SQLException: com.mchange.v2.c3p0.ComboPooledDataSource [ java.beans.IntrospectionException: java.lang.reflect.InvocationTargetException [lastAcquisitionFailureDefaultUser] ] has been closed() -- you can no longer use it.] at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:767) at org.quartz.impl.jdbcjobstore.JobStoreTX.getNonManagedTXConnection(JobStoreTX.java:71) at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3788) at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3760) at org.quartz.impl.jdbcjobstore.JobStoreSupport.triggeredJobComplete(JobStoreSupport.java:3000) at org.quartz.core.QuartzScheduler.notifyJobStoreJobComplete(QuartzScheduler.java:1772) at org.quartz.core.JobRunShell.run(JobRunShell.java:285) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:567) Caused by: java.sql.SQLException: com.mchange.v2.c3p0.ComboPooledDataSource [ java.beans.IntrospectionException: java.lang.reflect.InvocationTargetException [lastAcquisitionFailureDefaultUser] ] has been closed() -- you can no longer use it. at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.assertCpds(AbstractPoolBackedDataSource.java:447) at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getPoolManager(AbstractPoolBackedDataSource.java:459) at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128) at org.quartz.utils.PoolingConnectionProvider.getConnection(PoolingConnectionProvider.java:247) at org.quartz.utils.DBConnectionManager.getConnection(DBConnectionManager.java:108) at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:764) ... 7 more {code} To overcome this problem I created a method for the SimpleThreadPool with some copied code from its own shutdown method: {code:title=SimpleThreadPool.java| borderStyle=solid} public void waitForLastJobs() { synchronized (nextRunnableLock) { // Wait until all worker threads are shut down while (busyWorkers.size() > 0) { WorkerThread wt = (WorkerThread) busyWorkers.getFirst(); try { getLog().debug( "Waiting for thread " + wt.getName() + " to shut down"); // note: with waiting infinite time the // application may appear to 'hang'. nextRunnableLock.wait(2000); } catch (InterruptedException ex) { } } Iterator<WorkerThread> workerThreads = workers.iterator(); while (workerThreads.hasNext()) { WorkerThread wt = (WorkerThread) workerThreads.next(); try { wt.join(); workerThreads.remove(); } catch (InterruptedException ignore) { } } getLog().debug("All 'LastJobWorker' were executed and stopped."); } } {code} Then I added a call of that method in the QuartzScheduler, just after joining the scheduler thread, but before the jobstore is shutting down. My added code is between the two horizontal rulers. {code:title=QuartzScheduler.java| borderStyle=solid} resources.getThreadPool().shutdown(waitForJobsToComplete); if (waitForJobsToComplete) { while (jobMgr.getNumJobsCurrentlyExecuting() > 0) { try { Thread.sleep(100); } catch (Exception ignore) { } } } // Scheduler thread may have be waiting for the fire time of an acquired // trigger and need time to release the trigger once halted, so make sure // the thread is dead before continuing to shutdown the job store. try { schedThread.join(); } catch (InterruptedException ignore) { } //------------------ if(waitForJobsToComplete) { ((SimpleThreadPool) resources.getThreadPool()).waitForLastJobs(); } //------------------ closed = true; if (resources.getJMXExport()) { try { unregisterJMX(); } catch (Exception e) { } } if(boundRemotely) { try { unBind(); } catch (RemoteException re) { } } shutdownPlugins(); resources.getJobStore().shutdown(); {code} I'm no expert, maybe there is a better way to do this but for now it works for me and the errors are gone. Quartz is now really waiting until all jobs are done. Maybe my input is useful for someone who can look into it and use it somehow for the next official version.

    Terracotta Project Issue Tracker | 3 years ago | Steffen Ritter
    org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'myDS': java.sql.SQLException: com.mchange.v2.c3p0.ComboPooledDataSource [ java.beans.IntrospectionException: java.lang.reflect.InvocationTargetException [lastAcquisitionFailureDefaultUser] ] has been closed() -- you can no longer use it. [See nested exception: java.sql.SQLException: com.mchange.v2.c3p0.ComboPooledDataSource [ java.beans.IntrospectionException: java.lang.reflect.InvocationTargetException [lastAcquisitionFailureDefaultUser] ] has been closed() -- you can no longer use it.]
  2. 0

    There is the possibility that the scheduler is shutting down the jobstore while a job is still running. This should not happen if you shut down the scheduler with "sched.shutdown(true)", but it does. As a result, Quartz can't mark the job as "complete" although the WorkerThread will complete because of "shutdown(true)". If the job is marked for recovery it will be executed again (two times). Error output is as follows: {code:title=ErrorLog | borderStyle=solid} 17:35:22,440 ERROR [org.quartz.core.ErrorLogger] - An error occured while marking executed job complete. job= 'group_1.job_1' org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'myDS': java.sql.SQLException: com.mchange.v2.c3p0.ComboPooledDataSource [ java.beans.IntrospectionException: java.lang.reflect.InvocationTargetException [lastAcquisitionFailureDefaultUser] ] has been closed() -- you can no longer use it. [See nested exception: java.sql.SQLException: com.mchange.v2.c3p0.ComboPooledDataSource [ java.beans.IntrospectionException: java.lang.reflect.InvocationTargetException [lastAcquisitionFailureDefaultUser] ] has been closed() -- you can no longer use it.] at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:767) at org.quartz.impl.jdbcjobstore.JobStoreTX.getNonManagedTXConnection(JobStoreTX.java:71) at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3788) at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3760) at org.quartz.impl.jdbcjobstore.JobStoreSupport.triggeredJobComplete(JobStoreSupport.java:3000) at org.quartz.core.QuartzScheduler.notifyJobStoreJobComplete(QuartzScheduler.java:1772) at org.quartz.core.JobRunShell.run(JobRunShell.java:285) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:567) Caused by: java.sql.SQLException: com.mchange.v2.c3p0.ComboPooledDataSource [ java.beans.IntrospectionException: java.lang.reflect.InvocationTargetException [lastAcquisitionFailureDefaultUser] ] has been closed() -- you can no longer use it. at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.assertCpds(AbstractPoolBackedDataSource.java:447) at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getPoolManager(AbstractPoolBackedDataSource.java:459) at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128) at org.quartz.utils.PoolingConnectionProvider.getConnection(PoolingConnectionProvider.java:247) at org.quartz.utils.DBConnectionManager.getConnection(DBConnectionManager.java:108) at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:764) ... 7 more {code} To overcome this problem I created a method for the SimpleThreadPool with some copied code from its own shutdown method: {code:title=SimpleThreadPool.java| borderStyle=solid} public void waitForLastJobs() { synchronized (nextRunnableLock) { // Wait until all worker threads are shut down while (busyWorkers.size() > 0) { WorkerThread wt = (WorkerThread) busyWorkers.getFirst(); try { getLog().debug( "Waiting for thread " + wt.getName() + " to shut down"); // note: with waiting infinite time the // application may appear to 'hang'. nextRunnableLock.wait(2000); } catch (InterruptedException ex) { } } Iterator<WorkerThread> workerThreads = workers.iterator(); while (workerThreads.hasNext()) { WorkerThread wt = (WorkerThread) workerThreads.next(); try { wt.join(); workerThreads.remove(); } catch (InterruptedException ignore) { } } getLog().debug("All 'LastJobWorker' were executed and stopped."); } } {code} Then I added a call of that method in the QuartzScheduler, just after joining the scheduler thread, but before the jobstore is shutting down. My added code is between the two horizontal rulers. {code:title=QuartzScheduler.java| borderStyle=solid} resources.getThreadPool().shutdown(waitForJobsToComplete); if (waitForJobsToComplete) { while (jobMgr.getNumJobsCurrentlyExecuting() > 0) { try { Thread.sleep(100); } catch (Exception ignore) { } } } // Scheduler thread may have be waiting for the fire time of an acquired // trigger and need time to release the trigger once halted, so make sure // the thread is dead before continuing to shutdown the job store. try { schedThread.join(); } catch (InterruptedException ignore) { } //------------------ if(waitForJobsToComplete) { ((SimpleThreadPool) resources.getThreadPool()).waitForLastJobs(); } //------------------ closed = true; if (resources.getJMXExport()) { try { unregisterJMX(); } catch (Exception e) { } } if(boundRemotely) { try { unBind(); } catch (RemoteException re) { } } shutdownPlugins(); resources.getJobStore().shutdown(); {code} I'm no expert, maybe there is a better way to do this but for now it works for me and the errors are gone. Quartz is now really waiting until all jobs are done. Maybe my input is useful for someone who can look into it and use it somehow for the next official version.

    Terracotta Project Issue Tracker | 3 years ago | Steffen Ritter
    org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'myDS': java.sql.SQLException: com.mchange.v2.c3p0.ComboPooledDataSource [ java.beans.IntrospectionException: java.lang.reflect.InvocationTargetException [lastAcquisitionFailureDefaultUser] ] has been closed() -- you can no longer use it. [See nested exception: java.sql.SQLException: com.mchange.v2.c3p0.ComboPooledDataSource [ java.beans.IntrospectionException: java.lang.reflect.InvocationTargetException [lastAcquisitionFailureDefaultUser] ] has been closed() -- you can no longer use it.]
  3. 0

    Hibernate Community • View topic - hibernate- C3P0ConnectionProvider running out of connection

    hibernate.org | 1 year ago
    java.sql.SQLException: com.mchange.v2.c3p0.PoolBackedDataSource@c46e7a40 [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@15ce9731 [ acquireIncrement -> 2, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, debugUnreturnedConnectionStackTraces -> false, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 155h2bp8nfjie3i27t57o|39ea58, idleConnectionTestPeriod -> 60, initialPoolSize -> 5, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 360, maxIdleTimeExcessConnections -> 0, -> 100, maxStatements -> 75, maxStatementsPerConnection -> 0, minPoolSize -> 5, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@10529244 [ description -> null, driverClass -> null, factoryClassLocation -> null, identityToken -> 155h2bp8nfjie3i27t57o|199197b, jdbcUrl -> jdbc:oracle:oci:@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = cnlxrd43)(PORT = 1526)) (ADDRESS = (PROTOCOL = TCP)(HOST = cnlxrd42)(PORT = 1526)) (ADDRESS = (PROTOCOL = TCP)(HOST = cnlxrd41)(PORT = 1526)) (ADDRESS = (PROTOCOL = TCP)(HOST = cnlxrd44)(PORT = 1526)) (enable=broken) (FAILOVER = ON) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = AEU) (FAILOVER_MODE = (TYPE = SELECT) (METHOD = BASIC) (RETRIES = 180) (DELAY = 5)))), properties -> {user=******, password=******} ], preferredTestQuery -> null, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false; userOverrides: {} ], dataSourceName -> null, factoryClassLocation -> null, identityToken -> 155h2bp8nfjie3i27t57o|c12978, numHelperThreads -> 100 ] has been closed() -- you can no longer use it.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    AnnotationTransactionAspect is not recreated for @DirtiesContext

    Stack Overflow | 2 years ago | Eugene To
    org.hibernate.exception.GenericJDBCException: Cannot open connection
  6. 0

    ServiceMix - User - Failed to convert property value to required type 'org.aopalliance.aop.Advice' for property 'advice'

    nabble.com | 9 months ago
    java.sql.SQLException: com.mchange.v2.c3p0.ComboPooledDataSource [ java.beans.IntrospectionException: java.lang.reflect.InvocationTargetException [numThreadsAwaitingCheckoutDefaultUser] ] has been closed() -- you can no longer use it.

  1. DoktorDoener666 2 times, last 1 month ago
  2. Aldin Kiselica 1 times, last 3 months ago
  3. mortalman7 6 times, last 5 months ago
  4. regisso 1 times, last 7 months ago
21 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.sql.SQLException

    com.mchange.v2.c3p0.ComboPooledDataSource [ java.beans.IntrospectionException: java.lang.reflect.InvocationTargetException [lastAcquisitionFailureDefaultUser] ] has been closed() -- you can no longer use it.

    at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.assertCpds()
  2. c3p0:JDBC DataSources/Resource Pools
    AbstractPoolBackedDataSource.getConnection
    1. com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.assertCpds(AbstractPoolBackedDataSource.java:447)
    2. com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getPoolManager(AbstractPoolBackedDataSource.java:459)
    3. com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
    3 frames
  3. quartz
    SimpleThreadPool$WorkerThread.run
    1. org.quartz.utils.PoolingConnectionProvider.getConnection(PoolingConnectionProvider.java:247)
    2. org.quartz.utils.DBConnectionManager.getConnection(DBConnectionManager.java:108)
    3. org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:764)
    4. org.quartz.impl.jdbcjobstore.JobStoreTX.getNonManagedTXConnection(JobStoreTX.java:71)
    5. org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3788)
    6. org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3760)
    7. org.quartz.impl.jdbcjobstore.JobStoreSupport.triggeredJobComplete(JobStoreSupport.java:3000)
    8. org.quartz.core.QuartzScheduler.notifyJobStoreJobComplete(QuartzScheduler.java:1772)
    9. org.quartz.core.JobRunShell.run(JobRunShell.java:285)
    10. org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:567)
    10 frames