org.apache.jackrabbit.core.data.DataStoreException: Can not insert new record: connection has been closed and autoReconnect == false: connection has been closed and autoReconnect == false

JFrog JIRA | Brennan Spies | 8 years ago
  1. 0

    The Quartz job that Artifactory runs to update indexes is consistently throwing an exception due to the fact that the connection is closed and the autoReconnect flag is set to false. [9/11/08 18:06:28:980 PDT] 00000045 SystemOut O 2008-09-11 18:06:28,978 [WARN ] (data.db.DbDataStore :588) - Can not insert new record org.apache.jackrabbit.core.data.DataStoreException: Can not insert new record: connection has been closed and autoReconnect == false: connection has been closed and autoReconnect == false at org.apache.jackrabbit.core.data.db.DbDataStore.convert(DbDataStore.java:592) at org.apache.jackrabbit.core.data.db.DbDataStore.addRecord(DbDataStore.java:295) at org.apache.jackrabbit.core.value.BLOBInDataStore.getInstance(BLOBInDataStore.java:120) at org.apache.jackrabbit.core.value.InternalValue.getBLOBFileValue(InternalValue.java:644) at org.apache.jackrabbit.core.value.InternalValue.create(InternalValue.java:123) at org.apache.jackrabbit.core.PropertyImpl.setValue(PropertyImpl.java:609) at org.apache.jackrabbit.core.PropertyImpl.setValue(PropertyImpl.java:525) at org.apache.jackrabbit.core.NodeImpl.setProperty(NodeImpl.java:2309) at org.artifactory.jcr.fs.JcrFile.fillJcrData(JcrFile.java:591) at org.artifactory.jcr.fs.JcrFile.setResourceNode(JcrFile.java:550) at org.artifactory.jcr.fs.JcrFile.<init>(JcrFile.java:80) at org.artifactory.jcr.fs.JcrFile.<init>(JcrFile.java:164) at org.artifactory.repo.index.RepoIndexerData.saveIndexFiles(RepoIndexerData.java:103) at org.artifactory.repo.index.IndexerManagerImpl.saveIndexFiles(IndexerManagerImpl.java:168) at org.artifactory.repo.index.IndexerManagerImpl$$FastClassByCGLIB$$76058b92.invoke(<generated>) at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635) at org.artifactory.repo.index.IndexerManagerImpl$$EnhancerByCGLIB$$7cded8f3.saveIndexFiles(<generated>) at org.artifactory.repo.index.IndexerManagerImpl.index(IndexerManagerImpl.java:137) at org.artifactory.repo.index.IndexerManagerImpl$$FastClassByCGLIB$$76058b92.invoke(<generated>) at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635) at org.artifactory.repo.index.IndexerManagerImpl$$EnhancerByCGLIB$$7cded8f3.index(<generated>) at org.artifactory.repo.index.IndexerJob.onExecute(IndexerJob.java:25) at org.artifactory.schedule.ArtifactoryJob.execute(ArtifactoryJob.java:41) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525) Caused by: java.sql.SQLException: connection has been closed and autoReconnect == false at org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.getConnection(ConnectionRecoveryManager.java:159) at org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.executeStmtInternal(ConnectionRecoveryManager.java:287) at org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.executeStmt(ConnectionRecoveryManager.java:257) at org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.executeStmt(ConnectionRecoveryManager.java:237) at org.apache.jackrabbit.core.data.db.DbDataStore.addRecord(DbDataStore.java:286) ... 33 more The exception is thrown from the ConnectonRecoveryManager here: public synchronized Connection getConnection() throws SQLException, RepositoryException { if (isClosed) { if (autoReconnect) { reestablishConnection(); } else { throw new SQLException("connection has been closed and autoReconnect == false"); } } return connection; } The autoReconnect flag is by default set to true in the ConnectionRecoveryManager (http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ConnectionRecoveryManager.java?view=markup), but the problem is that this is set to false in the DbDataStore.addRecord() method: public DataRecord addRecord(InputStream stream) throws DataStoreException { ResultSet rs = null; TempFileInputStream fileInput = null; ConnectionRecoveryManager conn = getConnection(); try { conn.setAutoReconnect(false); // WHY??? //etc... There is a somewhat simplistic Pool class that holds instances of the ConnectionRecoveryManager (http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/Pool.java?view=markup), but it looks like there is no attempt here to test if the connection is still open (a la DBCP) when it is returned from the Pool. This looks like a Jackrabbit bug, but Artifactory probably needs to find a short-term workaround.

    JFrog JIRA | 8 years ago | Brennan Spies
    org.apache.jackrabbit.core.data.DataStoreException: Can not insert new record: connection has been closed and autoReconnect == false: connection has been closed and autoReconnect == false
  2. 0

    The Quartz job that Artifactory runs to update indexes is consistently throwing an exception due to the fact that the connection is closed and the autoReconnect flag is set to false. [9/11/08 18:06:28:980 PDT] 00000045 SystemOut O 2008-09-11 18:06:28,978 [WARN ] (data.db.DbDataStore :588) - Can not insert new record org.apache.jackrabbit.core.data.DataStoreException: Can not insert new record: connection has been closed and autoReconnect == false: connection has been closed and autoReconnect == false at org.apache.jackrabbit.core.data.db.DbDataStore.convert(DbDataStore.java:592) at org.apache.jackrabbit.core.data.db.DbDataStore.addRecord(DbDataStore.java:295) at org.apache.jackrabbit.core.value.BLOBInDataStore.getInstance(BLOBInDataStore.java:120) at org.apache.jackrabbit.core.value.InternalValue.getBLOBFileValue(InternalValue.java:644) at org.apache.jackrabbit.core.value.InternalValue.create(InternalValue.java:123) at org.apache.jackrabbit.core.PropertyImpl.setValue(PropertyImpl.java:609) at org.apache.jackrabbit.core.PropertyImpl.setValue(PropertyImpl.java:525) at org.apache.jackrabbit.core.NodeImpl.setProperty(NodeImpl.java:2309) at org.artifactory.jcr.fs.JcrFile.fillJcrData(JcrFile.java:591) at org.artifactory.jcr.fs.JcrFile.setResourceNode(JcrFile.java:550) at org.artifactory.jcr.fs.JcrFile.<init>(JcrFile.java:80) at org.artifactory.jcr.fs.JcrFile.<init>(JcrFile.java:164) at org.artifactory.repo.index.RepoIndexerData.saveIndexFiles(RepoIndexerData.java:103) at org.artifactory.repo.index.IndexerManagerImpl.saveIndexFiles(IndexerManagerImpl.java:168) at org.artifactory.repo.index.IndexerManagerImpl$$FastClassByCGLIB$$76058b92.invoke(<generated>) at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635) at org.artifactory.repo.index.IndexerManagerImpl$$EnhancerByCGLIB$$7cded8f3.saveIndexFiles(<generated>) at org.artifactory.repo.index.IndexerManagerImpl.index(IndexerManagerImpl.java:137) at org.artifactory.repo.index.IndexerManagerImpl$$FastClassByCGLIB$$76058b92.invoke(<generated>) at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635) at org.artifactory.repo.index.IndexerManagerImpl$$EnhancerByCGLIB$$7cded8f3.index(<generated>) at org.artifactory.repo.index.IndexerJob.onExecute(IndexerJob.java:25) at org.artifactory.schedule.ArtifactoryJob.execute(ArtifactoryJob.java:41) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525) Caused by: java.sql.SQLException: connection has been closed and autoReconnect == false at org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.getConnection(ConnectionRecoveryManager.java:159) at org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.executeStmtInternal(ConnectionRecoveryManager.java:287) at org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.executeStmt(ConnectionRecoveryManager.java:257) at org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.executeStmt(ConnectionRecoveryManager.java:237) at org.apache.jackrabbit.core.data.db.DbDataStore.addRecord(DbDataStore.java:286) ... 33 more The exception is thrown from the ConnectonRecoveryManager here: public synchronized Connection getConnection() throws SQLException, RepositoryException { if (isClosed) { if (autoReconnect) { reestablishConnection(); } else { throw new SQLException("connection has been closed and autoReconnect == false"); } } return connection; } The autoReconnect flag is by default set to true in the ConnectionRecoveryManager (http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ConnectionRecoveryManager.java?view=markup), but the problem is that this is set to false in the DbDataStore.addRecord() method: public DataRecord addRecord(InputStream stream) throws DataStoreException { ResultSet rs = null; TempFileInputStream fileInput = null; ConnectionRecoveryManager conn = getConnection(); try { conn.setAutoReconnect(false); // WHY??? //etc... There is a somewhat simplistic Pool class that holds instances of the ConnectionRecoveryManager (http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/Pool.java?view=markup), but it looks like there is no attempt here to test if the connection is still open (a la DBCP) when it is returned from the Pool. This looks like a Jackrabbit bug, but Artifactory probably needs to find a short-term workaround.

    JFrog JIRA | 8 years ago | Brennan Spies
    org.apache.jackrabbit.core.data.DataStoreException: Can not insert new record: connection has been closed and autoReconnect == false: connection has been closed and autoReconnect == false
  3. 0

    Transaction problem

    Oracle Community | 1 decade ago | 3004
    java.sql.SQLException: Connection handle has been closed and is unusable
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Transaction problem

    Oracle Community | 1 decade ago | 3004
    java.sql.SQLException: Connection handle has been closed and is unusable
  6. 0

    Transaction problem

    Oracle Community | 1 decade ago | 3004
    java.sql.SQLException: Connection handle has been closed and is unusable

    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

      connection has been closed and autoReconnect == false

      at org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.getConnection()
    2. org.apache.jackrabbit
      ConnectionRecoveryManager.executeStmt
      1. org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.getConnection(ConnectionRecoveryManager.java:159)
      2. org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.executeStmtInternal(ConnectionRecoveryManager.java:287)
      3. org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.executeStmt(ConnectionRecoveryManager.java:257)
      4. org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.executeStmt(ConnectionRecoveryManager.java:237)
      4 frames
    3. Jackrabbit Data
      DbDataStore.addRecord
      1. org.apache.jackrabbit.core.data.db.DbDataStore.addRecord(DbDataStore.java:286)
      1 frame
    4. Jackrabbit Core
      NodeImpl.setProperty
      1. org.apache.jackrabbit.core.value.BLOBInDataStore.getInstance(BLOBInDataStore.java:120)
      2. org.apache.jackrabbit.core.value.InternalValue.getBLOBFileValue(InternalValue.java:644)
      3. org.apache.jackrabbit.core.value.InternalValue.create(InternalValue.java:123)
      4. org.apache.jackrabbit.core.PropertyImpl.setValue(PropertyImpl.java:609)
      5. org.apache.jackrabbit.core.PropertyImpl.setValue(PropertyImpl.java:525)
      6. org.apache.jackrabbit.core.NodeImpl.setProperty(NodeImpl.java:2309)
      6 frames
    5. org.artifactory.jcr
      JcrFile.<init>
      1. org.artifactory.jcr.fs.JcrFile.fillJcrData(JcrFile.java:591)
      2. org.artifactory.jcr.fs.JcrFile.setResourceNode(JcrFile.java:550)
      3. org.artifactory.jcr.fs.JcrFile.<init>(JcrFile.java:80)
      4. org.artifactory.jcr.fs.JcrFile.<init>(JcrFile.java:164)
      4 frames
    6. org.artifactory.repo
      IndexerManagerImpl$$FastClassByCGLIB$$76058b92.invoke
      1. org.artifactory.repo.index.RepoIndexerData.saveIndexFiles(RepoIndexerData.java:103)
      2. org.artifactory.repo.index.IndexerManagerImpl.saveIndexFiles(IndexerManagerImpl.java:168)
      3. org.artifactory.repo.index.IndexerManagerImpl$$FastClassByCGLIB$$76058b92.invoke(<generated>)
      3 frames
    7. IDEA
      MethodProxy.invoke
      1. net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
      1 frame
    8. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
      2. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
      2 frames
    9. Spring Tx
      TransactionInterceptor.invoke
      1. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
      1 frame
    10. Spring AOP
      Cglib2AopProxy$DynamicAdvisedInterceptor.intercept
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      2. org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)
      2 frames
    11. org.artifactory.repo
      IndexerManagerImpl$$FastClassByCGLIB$$76058b92.invoke
      1. org.artifactory.repo.index.IndexerManagerImpl$$EnhancerByCGLIB$$7cded8f3.saveIndexFiles(<generated>)
      2. org.artifactory.repo.index.IndexerManagerImpl.index(IndexerManagerImpl.java:137)
      3. org.artifactory.repo.index.IndexerManagerImpl$$FastClassByCGLIB$$76058b92.invoke(<generated>)
      3 frames
    12. IDEA
      MethodProxy.invoke
      1. net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
      1 frame
    13. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
      2. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
      2 frames
    14. Spring Tx
      TransactionInterceptor.invoke
      1. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
      1 frame
    15. Spring AOP
      Cglib2AopProxy$DynamicAdvisedInterceptor.intercept
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      2. org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)
      2 frames
    16. org.artifactory.repo
      IndexerJob.onExecute
      1. org.artifactory.repo.index.IndexerManagerImpl$$EnhancerByCGLIB$$7cded8f3.index(<generated>)
      2. org.artifactory.repo.index.IndexerJob.onExecute(IndexerJob.java:25)
      2 frames
    17. org.artifactory.schedule
      ArtifactoryJob.execute
      1. org.artifactory.schedule.ArtifactoryJob.execute(ArtifactoryJob.java:41)
      1 frame
    18. quartz
      SimpleThreadPool$WorkerThread.run
      1. org.quartz.core.JobRunShell.run(JobRunShell.java:202)
      2. org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
      2 frames