4 Replies Latest reply on Oct 28, 2006 12:54 PM by luowp

    problem closing services - Caused by: org.jbpm.persistence.J

    bbela

      Hi!

      I have a problem with persistence too.

      JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
      //... process management statements ...
      jbpmContext.close();

      At the .close() call I get the following Exception:

      org.jbpm.JbpmException: problem closing services {persistence=org.jbpm.persistence.JbpmPersistenceException: couldn't commit hibernate session}
      at org.jbpm.svc.Services.close(Services.java:223)
      at org.jbpm.JbpmContext.close(JbpmContext.java:138)
      at hu.neuron.jbpm.tutorial.HelloWorldProcess.main(HelloWorldProcess.java:83)
      Caused by: org.jbpm.persistence.JbpmPersistenceException: couldn't commit hibernate session
      at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:171)
      at org.jbpm.svc.Services.close(Services.java:211)
      ... 2 more
      Caused by: org.hibernate.TransientObjectException: org.jbpm.graph.def.Node
      at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:216)
      at org.hibernate.type.EntityType.getIdentifier(EntityType.java:108)
      at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:221)
      at org.hibernate.type.TypeFactory.findDirty(TypeFactory.java:476)
      at org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:2803)
      at org.hibernate.event.def.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:467)
      at org.hibernate.event.def.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:190)
      at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:113)
      at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:195)
      at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
      at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
      at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985)
      at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:333)
      at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
      at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:161)
      ... 3 more
      Hlp Plz!
      Thx!

        • 1. Re: problem closing services - Caused by: org.jbpm.persisten
          koen.aers

          I am not really sure, but this looks like you have attached objects to the object graph outside of a hibernate session. What exactly are you trying to do in your 'process management statements...'. Can post them here?

          Regards,
          Koen

          • 2. Re: problem closing services - Caused by: org.jbpm.persisten
            marcoferraz

            HI... did u already resolve this problem=? because i am having the same problem...

            here's.. my code:


            import java.io.Serializable;
            import java.util.ArrayList;
            import java.util.Collection;
            import java.util.Date;
            import java.util.HashMap;
            import java.util.Iterator;
            import java.util.List;
            import java.util.Map;

            import org.jbpm.db.*;
            import org.jbpm.graph.def.*;
            import org.jbpm.graph.exe.*;
            import org.jbpm.*;
            import org.jbpm.db.JbpmSession;
            import org.jbpm.db.JbpmSessionFactory;
            import org.jbpm.graph.def.DelegationException;
            import org.jbpm.graph.exe.Token;




            public class xixas{
            static JbpmConfiguration jbpmConfiguration = null;

            static {
            // An example configuration file such as this can be found in
            // 'src/config.files'. Typically the configuration information is in the
            // resource file 'jbpm.cfg.xml', but here we pass in the configuration
            // information as an XML string.

            // First we create a JbpmConfiguration statically. One JbpmConfiguration
            // can be used for all threads in the system, that is why we can safely
            // make it static.

            jbpmConfiguration = JbpmConfiguration.parseXmlString(
            "<jbpm-configuration>" +

            // A jbpm-context mechanism separates the jbpm core
            // engine from the services that jbpm uses from
            // the environment.

            " <jbpm-context>" +


            " <service name='persistence' " +
            " factory='org.jbpm.persistence.db.DbPersistenceServiceFactory' />" +
            " <service name='message' " +
            " factory='org.jbpm.msg.db.DbMessageServiceFactory' />" +
            " <service name='scheduler' " +
            " factory='org.jbpm.scheduler.db.DbSchedulerServiceFactory' />" +
            " <service name='logging' " +
            " factory='org.jbpm.logging.db.DbLoggingServiceFactory' />" +
            " <service name='authentication' " +
            " factory='org.jbpm.security.authentication.DefaultAuthenticationServiceFactory' />" +
            " <service name='persistence' " +
            " factory='org.jbpm.persistence.db.DbPersistenceServiceFactory' />" +
            " </jbpm-context>" +

            // Also all the resource files that are used by jbpm are
            // referenced from the jbpm.cfg.xml

            " <string name='resource.hibernate.cfg.xml' " +
            " value='hibernate.cfg.xml' />" +
            " <string name='resource.business.calendar' " +
            " value='org/jbpm/calendar/jbpm.business.calendar.properties' />" +
            " <string name='resource.default.modules' " +
            " value='org/jbpm/graph/def/jbpm.default.modules.properties' />" +
            " <string name='resource.converter' " +
            " value='org/jbpm/db/hibernate/jbpm.converter.properties' />" +
            " <string name='resource.action.types' " +
            " value='org/jbpm/graph/action/action.types.xml' />" +
            " <string name='resource.node.types' " +
            " value='org/jbpm/graph/node/node.types.xml' />" +
            " <string name='resource.varmapping' " +
            " value='org/jbpm/context/exe/jbpm.varmapping.xml' />" +
            "</jbpm-configuration>"
            );
            }



            public void inst (int i)
            {

            //int version;
            JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
            try {

            GraphSession graphSession = jbpmContext.getGraphSession();

            ProcessDefinition processDefinition =
            graphSession.findLatestProcessDefinition("teste");

            // With the processDefinition that we retrieved from the database, we
            // can create an execution of the process definition just like in the
            // hello world example (which was without persistence).
            ProcessInstance processInstance =
            new ProcessInstance(processDefinition);

            //version=processInstance.getVersion();

            // processInstance.signal();
            //processInstance.signal();


            Token token = processInstance.getRootToken();

            // Also after construction, the main path of execution is positioned
            // in the start-state of the process definition.
            // assertSame(processDefinition.getStartState(), token.getNode());

            // Let's start the process execution, leaving the start-state
            // over its default transition.
            token.signal();


            // Token token = processInstance.getRootToken();
            // assertEquals("inicio", token.getNode().getName());
            // Let's start the process execution
            // token.signal();
            // Now the process is in the state 's'.
            // assertEquals("inicio", token.getNode().getName());

            // Now the processInstance is saved in the database. So the
            // current state of the execution of the process is stored in the
            // database.
            jbpmContext.save(processInstance);



            } finally {
            // Tear down the pojo persistence context.
            jbpmContext.close();


            }
            //return version;
            }
            }


            Can anyone see?

            • 3. Re: problem closing services - Caused by: org.jbpm.persisten
              mohan514

              iam also gettign the excetion that u ppl got her is the code that iam using to close(end()) the task instance.
              ProcessDefinition processDefinition = graphSession.loadProcessDefinition(processDefinitionId);
              ProcessInstance processInstance = jbpmContext.newProcessInstance(processDefinition.getName());
              ContextInstance contextInstance = (ContextInstance) processInstance.getInstance(ContextInstance.class);
              TaskInstance startTaskInstance = processInstance.getTaskMgmtInstance().createStartTaskInstance();
              startTaskInstance.end();
              if any one got the solution please let me know.
              Regards,
              mohan chokkakula.
              +91-9893328559

              • 4. Re: problem closing services - Caused by: org.jbpm.persisten
                luowp

                I have the similar problems. When I deployed using jbpm starter kit. It works OK. But in Geronimo, the hibernate connection lost after several hours.