2 Replies Latest reply on Oct 23, 2005 8:15 AM by koen.aers

    Connection problem with scheduler

    jnjintc

      Hi,

      I think I am having a problem when I use the JBPM scheduler and I close my SessionFactory. When I try to re-run the Jbpm Scheduler after re-opening my SessionFactory then I get "GenericJdbcException". Is says the connection is closed

      Typically I pass the connection around when opening hibernate sessions and I do not have a problem. My application requires me to be able to close SessionFactories and open session factories programitically.

      If I close my Session factory and then reopen and try to use the scheduler I get this error.

      One issue might be that the jbpm scheduler code does not allow me to pass in my own connection, so I am not sure how to proceed.

      Is allowing the Jbpm scheduler to accept a hibernate connection something that is planned on or is it a request I can make ?

      Any advice ?

      thanks,
      Adam

        • 1. Re: Connection problem with scheduler
          jnjintc

          here is the stacktrace

          3:02:19,336 ERROR [JbpmSession] org.hibernate.exception.GenericJDBCException: Cannot open connection
          13:02:19,336 INFO [SchedulerThread] runtime exception while executing timers
          java.lang.RuntimeException: couldn't begin a transaction
          at org.jbpm.db.JbpmSession.beginTransaction(JbpmSession.java:93)
          at org.jbpm.db.JbpmSessionFactory.openJbpmSessionAndBeginTransaction(JbpmSessionFactory.java:186)
          at org.jbpm.scheduler.impl.SchedulerThread.executeTimers(SchedulerThread.java:64)
          at org.jbpm.scheduler.impl.SchedulerThread.run(SchedulerThread.java:34)
          Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection
          at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:82)
          at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:70)
          at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
          at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
          at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:301)
          at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:110)
          at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:137)
          at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:49)
          at org.hibernate.transaction.JDBCTransactionFactory.beginTransaction(JDBCTransactionFactory.java:24)
          at org.hibernate.jdbc.JDBCContext.beginTransaction(JDBCContext.java:271)
          at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1079)
          at org.jbpm.db.JbpmSession.beginTransaction(JbpmSession.java:89)
          ... 3 more
          Caused by: java.sql.SQLException: com.mchange.v2.c3p0.PoolBackedDataSource@d71256 [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@15a1c5f [ acquireIncrement -> 1, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, idleConnectionTestPeriod -> 0, initialPoolSize -> 1, maxIdleTime -> 0, maxPoolSize -> 5, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 1, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@1562f00 [ description -> null, driverClass -> null, factoryClassLocation -> null, jdbcUrl -> jdbc:postgresql://localhost:5432/myWFDB, properties -> {user=******, password=******} ] , preferredTestQuery -> null, propertyCycle -> 300, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, usesTraditionalReflectiveProxies -> false ] , factoryClassLocation -> null, numHelperThreads -> 3, poolOwnerIdentityToken -> d71256 ] has been closed() -- you can no longer use it.
          at com.mchange.v2.c3p0.PoolBackedDataSource.assertCpds(PoolBackedDataSource.java:200)
          at com.mchange.v2.c3p0.PoolBackedDataSource.getPoolManager(PoolBackedDataSource.java:212)
          at com.mchange.v2.c3p0.PoolBackedDataSource.getConnection(PoolBackedDataSource.java:64)
          at org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:35)
          at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:298)
          ... 10 more

          • 2. Re: Connection problem with scheduler
            koen.aers

            At the moment this is indeed not possible. You can file a JIRA request for this behaviour. But if you really need it fast, it is not very difficult to implement it yourself. Looking at the SchedulerThread and SchedulerServlet class for an example. And we will be very grateful if you contribute your enhancements ;-)

            Regards,
            Koen