[jboss-user] [JBoss jBPM] - [CachedConnectionManager] Closing a connection for you

sylobsa do-not-reply at jboss.com
Wed Aug 1 10:54:53 EDT 2007


JBoss4.2.0.GA
jBPM 3.2.0.GA

Hi,
I'm trying to use jBPM 3 in an existing application. I can deploy processes definitions, but when I try to get the process list, I get an error message :
[CachedConnectionManager] Closing a connection for you 

Investigating on this error I found that :
   - The error occurs in "org.jbpm.persistence.db.DbPersistenceService" when the "Connection getConnection(boolean resolveSession)" method is called
   - The connection hasn't been closed because when the "Exception closeConnection()" method is called, the variable mustConnectionBeClosed is set to false
   
Looking for the reason why "mustConnectionBeClosed", here is the code executed :

In my class :
  jbpmContext.getGraphSession().findLatestProcessDefinitions()

In DbPersistenceService :

  public GraphSession getGraphSession() {
    if (graphSession==null) {
      Session session = getSession(); //-- 1
      ...

  public Session getSession() {
    if ( (session==null)
         && (getSessionFactory()!=null) 
       ) {
      Connection connection = getConnection(false); //-- 2 
      if (isCurrentSessionEnabled) {
        ...
      } else if (connection!=null) {
        log.debug("creating hibernate session with connection "+connection);
        session = getSessionFactory().openSession(connection);
        mustSessionBeClosed = true;
        mustSessionBeFlushed = true;
        mustConnectionBeClosed = false; //-- 4
        ...


  public Connection getConnection(boolean resolveSession) {
    if (connection==null) {
      if (persistenceServiceFactory.getDataSource()!=null) { 
        try {
          log.debug("fetching jdbc connection from datasource");
          connection = persistenceServiceFactory.getDataSource().getConnection();
          mustConnectionBeClosed = true; //-- 3
          ...

"mustConnectionBeClosed" is first set to true (//-- 3) getting the connection, then set to false (//-- 4) some lines further, after opening the session.

Is this normal ?  How to avoid the error message ? Did I miss something in the configuration ?

Regards
A. ROY


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4069676#4069676

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4069676



More information about the jboss-user mailing list