1 2 3 Previous Next 30 Replies Latest reply on Mar 25, 2011 4:31 PM by t-9000

    JBPM 4.3 - org.jbpm.api.JbpmException: couldn't acquire block of ids

      Hi,

       

      I'm using JBPM 4.3 with Postgresql 8.4 and I need help to solve the follow error that emerge any time I tray to deploy a process.

      I do not know what check or debug ... any Ideas ?

      Do you need other info about my JBPM configuration ?

       

      org.jbpm.api.JbpmException: couldn't acquire block of ids
          at org.jbpm.pvm.internal.id.DatabaseDbidGenerator.getNextId(DatabaseDbidGenerator.java:65)
          at org.jbpm.pvm.internal.repository.RepositorySessionImpl.deploy(RepositorySessionImpl.java:56)
          at org.jbpm.pvm.internal.cmd.DeployCmd.execute(DeployCmd.java:47)
          at org.jbpm.pvm.internal.cmd.DeployCmd.execute(DeployCmd.java:33)
          at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
          at org.jbpm.pvm.internal.tx.SpringCommandCallback.doInTransaction(SpringCommandCallback.java:45)
          at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
          at org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:55)
          at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)

       

      Thanks in advance.

        • 1. Re: JBPM 4.3 - org.jbpm.api.JbpmException: couldn't acquire block of ids
          rebody

          Hi Stefano,

            Could you show me the full exception stack trace?  These information is not enough.

          • 2. Re: JBPM 4.3 - org.jbpm.api.JbpmException: couldn't acquire block of ids

            Here.

             

            org.jbpm.api.JbpmException: couldn't acquire block of ids
                at org.jbpm.pvm.internal.id.DatabaseDbidGenerator.getNextId(DatabaseDbidGenerator.java:65)
                at org.jbpm.pvm.internal.repository.RepositorySessionImpl.deploy(RepositorySessionImpl.java:56)
                at org.jbpm.pvm.internal.cmd.DeployCmd.execute(DeployCmd.java:47)
                at org.jbpm.pvm.internal.cmd.DeployCmd.execute(DeployCmd.java:33)
                at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
                at org.jbpm.pvm.internal.tx.SpringCommandCallback.doInTransaction(SpringCommandCallback.java:45)
                at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
                at org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:55)
                at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)
                at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
                at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
                at org.jbpm.pvm.internal.repository.DeploymentImpl.deploy(DeploymentImpl.java:91)
                at net.tinvention.wf.jbpm.JbpmProcessBean.initialize(JbpmProcessBean.java:83)
                at net.tinvention.wf.jbpm.JbpmProcessBean$$FastClassByCGLIB$$180e3dad.invoke(<generated>)
                at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
                at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:692)
                at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
                at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
                at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
                at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:625)
                at net.tinvention.wf.jbpm.JbpmProcessBean$$EnhancerByCGLIB$$62627048.initialize(<generated>)
                at net.emaze.sms.wf.jbpm.HelloWorldSirJBPMTest.testFindExecutionById(HelloWorldSirJBPMTest.java:30)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:597)
                at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
                at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
                at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
                at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
                at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
                at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
                at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
                at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)
                at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
                at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)
                at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
                at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
                at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
                at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
                at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
                at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
                at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
                at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
                at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
                at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)
                at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
                at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
                at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
                at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:597)
                at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
                at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
            Caused by: java.lang.NullPointerException
                at org.jbpm.pvm.internal.id.AcquireDbidBlockCmd.execute(AcquireDbidBlockCmd.java:29)
                at org.jbpm.pvm.internal.id.AcquireDbidBlockCmd.execute(AcquireDbidBlockCmd.java:10)
                at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
                at org.jbpm.pvm.internal.tx.SpringCommandCallback.doInTransaction(SpringCommandCallback.java:45)
                at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
                at org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:55)
                at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)
                at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
                at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
                at org.jbpm.pvm.internal.id.DatabaseDbidGenerator.acquireDbidBlock(DatabaseDbidGenerator.java:76)
                at org.jbpm.pvm.internal.id.DatabaseDbidGenerator.getNextId(DatabaseDbidGenerator.java:63)
                ... 55 more

            • 3. Re: JBPM 4.3 - org.jbpm.api.JbpmException: couldn't acquire block of ids
              swiderski.maciej

              Hi,

               

              seems like some problems with accessing data base. You could enable debug or trace for hibernate logs perhaps that could put some more insights.

               

              Cheers,

              Maciej

              • 4. Re: JBPM 4.3 - org.jbpm.api.JbpmException: couldn't acquire block of ids

                Thank guys for immediate suppprt ...

                 

                Maciej waht kinf of logs of Hibernate I need to activate to help you help me :-)  ?

                 

                I'm investigating ... I found that in AcquireDbidBlockCmd property object result from the query obtained from the code reported below is null .

                 

                public Long execute(Environment environment) throws Exception {
                    Session session = environment.get(Session.class);
                   
                    PropertyImpl property = (PropertyImpl) session.createQuery(
                        "select property " +
                        "from "+PropertyImpl.class.getName()+" as property " +
                        "where property.key = '"+PropertyImpl.NEXT_DBID_KEY+"'"
                    ).uniqueResult();

                 

                Here property is null !!

                 

                My interested configuration is

                ....

                <task-service />
                        <object class="org.jbpm.pvm.internal.id.DatabaseDbidGenerator">
                            <field name="commandService">
                                <ref object="txRequiredCommandService" />
                            </field>
                        </object>
                        <object class="org.jbpm.pvm.internal.id.DatabaseIdComposer"  init="eager" />

                 

                Is it correct ?

                 

                Transcations seems ok from logs.

                • 5. Re: JBPM 4.3 - org.jbpm.api.JbpmException: couldn't acquire block of ids
                  rebody

                  Hi Stefano,

                    When we delete the record from JBPM4_PROPERTY and didn't restart the server, the error will ocurred.

                   

                    Because when process engine initialize itself, it will use InitializePropertiesCmd to insert a record into JBPM4_PROPERTY.  Then at the runtime, AcquireDbidBlockCmd could get next id from JBPM4_PROPERTY, if it is necessary.

                   

                    The easiest way to solve this problem is restart you server, then the process engine will re-initalize database.

                  • 6. Re: JBPM 4.3 - org.jbpm.api.JbpmException: couldn't acquire block of ids

                    Huisheng Xu "The easiest way to solve this problem is restart you server, then the process engine will re-initalize database."

                     

                    With the term "server" what do you mean in jbpm terms ? what is the method object to call getting the shutdown ?

                    I'm using ProcessEngine instance do you mean this object ? I need to call ProcessEngine.close() and after ProcessEngine.buildProcessEngine() to restart "the server" ?

                     

                    Calling ProcessEngine.close() and after ProcessEngine.buildProcessEngine():  It works thanks !!

                     

                    So I'm a bit confused , how can implement hot deploy of new processes in my multi-threaded application ? According to jbpm javadocs I have decided to have only one ProcessEngine instance shared between threads ... If I need to ProcessEngine.close() every new jbpm process deploy: I cannot imagine a good solution to manage this situation in the application.

                     

                    I suspect this is a common situation, How do you  manage it ? Anyone can suggest me a proven guide line ?

                    Thanks in advance !!

                    • 7. Re: JBPM 4.3 - org.jbpm.api.JbpmException: couldn't acquire block of ids
                      rebody

                      Hi Stefano,

                        My explaination of nextId initialization is totally wrong.  PVM didn't use InitializePropertiesCmd to intialize the JBPM4_PROPERTY.  In fact, the initialization job is done by CheckDbCmd.

                       

                        It is very strange for me, because it means if we don't use CheckDbCmd at the first time, e.g. invoke ConfigurationImpl.skipDbCheck(), then the JBPM4_PROPERTY will be empty and the NullPointerException will occure.

                       

                        Is it a bug of jBPM 4.3?

                      • 8. Re: JBPM 4.3 - org.jbpm.api.JbpmException: couldn't acquire block of ids
                        rebody

                        Hi Stefano,

                          The JBPM4_PROPRETY only need be intialize once.  You needn't restart the process engine again and again.  The real question is why jBPM4_PROPERTY didn't be initialize at the first time.  Did you truncate your database after the PVM started.

                        • 9. Re: JBPM 4.3 - org.jbpm.api.JbpmException: couldn't acquire block of ids

                          Huisheng Xu Did you truncate your database after the PVM started ?

                           

                          I did not truncate anything.

                           

                          I'm investigating ... any other ideas ?

                          • 10. Re: JBPM 4.3 - org.jbpm.api.JbpmException: couldn't acquire block of ids
                            swiderski.maciej

                            Hi,

                             

                            If it comes to enabling logging for hibernate I meant to print out sql statements that are executed. Based on that you can verify if all statements are executed.

                            Could you provide some details about your environment? Do you run your process on JEE server or as a unit test or ...

                            How did you create jBPM data base?

                             

                            Cheers,

                            Maciej

                            • 11. Re: JBPM 4.3 - org.jbpm.api.JbpmException: couldn't acquire block of ids

                              Hi Maciej

                               

                              I'm integratig JBPM into webapp based on Spring 3.0 all thing are managed using spring. Here sono details:

                              Datasource is DBCP via JNDI

                              TransactionManager is managed by spring

                              Persistace is Spring and Ibatis based

                              HBMSession, used only for jbpm, is configured as this

                               

                              <bean id="sessionFactory" >
                                      <property name="dataSource" ref="appDataSource" />
                                      <property name="useTransactionAwareDataSource" value="true" /> <!--  it use transaciton spring managed -->
                                      <property name="hibernateProperties">
                                        <value>
                                          hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
                                          hibernate.hbm2ddl.auto=update
                                          hibernate.format_sql=true
                                          hibernate.show_sql=true
                                        </value>
                                      </property>
                                      <property name="mappingLocations">
                                          <list>
                                              <value>classpath:jbpm.execution.hbm.xml</value>
                                              <value>classpath:jbpm.repository.hbm.xml</value>
                                              <value>classpath:jbpm.task.hbm.xml</value>
                                              <value>classpath:jbpm.history.hbm.xml</value>
                                              <value>classpath:jbpm.identity.hbm.xml</value>
                                          </list>
                                      </property>
                                  </bean>

                               

                              JBPM Spring iontegration is done using jbpm community way:

                               

                              <bean id="springJbpmHelper" name="springHelper" >
                                     <property name="jbpmCfg" value="conf/jbpm.cfg.xml" />
                              </bean>   
                              <bean id="processEngine" factory-bean="springJbpmHelper" factory-method="createProcessEngine" />

                               

                              My JBPMConfiguration is here:

                               

                              <jbpm-configuration>

                                  <!--  <import resource="jbpm.default.cfg.xml" />-->

                                  <!--

                                      jbpm.default.cfg.xml , modified <repository-cache /> with <object

                                      class="org.jbpm.pvm.internal.repository.RepositoryCacheImpl" />

                                  -->

                                  <import resource="jbpm.default.scriptmanager.xml" />

                                  <process-engine-context>

                                      <repository-service />

                                      <!--    <repository-cache /> -->

                                      <object />

                                      <execution-service />

                                      <history-service />

                                      <management-service />

                                      <identity-service />

                                      <task-service />

                                      <object>

                                          <field name="commandService">

                                              <ref object="txRequiredCommandService" />

                                          </field>

                                      </object>

                                      <object  init="eager" />

                                      <types resource="jbpm.variable.types.xml" />

                                      <address-resolver />

                                      <mail-template name='task-notification'>

                                          <to users="${task.assignee}" />

                                          <subject>${task.name}</subject>

                                          <text><![CDATA[Hi ${task.assignee}, Task "${task.name}" has been assigned to you. ${task.description}

                                                      Sent by JBoss jBPM ]]></text>

                                      </mail-template>

                               

                                      <mail-template name='task-reminder'>

                                          <to users="${task.assignee}" />

                                          <subject>${task.name}</subject>

                                          <text><![CDATA[Hey ${task.assignee}, Do not forget about task "${task.name}". ${task.description}

                                                      Sent by JBoss jBPM

                                          ]]></text>

                                      </mail-template>

                                  </process-engine-context>

                               

                                  <transaction-context>

                                      <repository-session />

                                      <db-session />

                                      <message-session />

                                      <timer-session />

                                      <history-sessions>

                                          <object />

                                      </history-sessions>

                                      <mail-session>

                                          <mail-server>

                                              <session-properties resource="jbpm.mail.properties" />

                                          </mail-server>

                                      </mail-session>

                                  </transaction-context>

                               

                                  <!--  <import resource="jbpm.variable.types.cfg.xml" /> -->

                                  <import resource="jbpm.jpdl.cfg.xml" />

                                  <import resource="jbpm.tx.spring.cfg.xml" />

                                  <import resource="jbpm.identity.cfg.xml" />

                               

                              </jbpm-configuration>

                               

                              The issue is present also on junit testing or using the webapp ...

                              Junit testing enviroment is based on AbstractJUnit4SpringContextTests .

                               

                              Here some sql printed by hibernate, as you asked:

                               

                              Hibernate:
                                  select
                                      propertyim0_.KEY_ as KEY1_6_,
                                      propertyim0_.VERSION_ as VERSION2_6_,
                                      propertyim0_.VALUE_ as VALUE3_6_
                                  from
                                      JBPM4_PROPERTY propertyim0_ limit ?
                              Hibernate:
                                  select
                                      this_.KEY_ as KEY1_6_0_,
                                      this_.VERSION_ as VERSION2_6_0_,
                                      this_.VALUE_ as VALUE3_6_0_
                                  from
                                      JBPM4_PROPERTY this_
                                  where
                                      this_.KEY_=?
                              Hibernate:
                                  select
                                      this_.KEY_ as KEY1_6_0_,
                                      this_.VERSION_ as VERSION2_6_0_,
                                      this_.VALUE_ as VALUE3_6_0_
                                  from
                                      JBPM4_PROPERTY this_
                                  where
                                      this_.KEY_=?
                              Hibernate:
                                  insert
                                  into
                                      JBPM4_PROPERTY
                                      (VERSION_, VALUE_, KEY_)
                                  values
                                      (?, ?, ?)
                              Hibernate:
                                  select
                                      this_.KEY_ as KEY1_6_0_,
                                      this_.VERSION_ as VERSION2_6_0_,
                                      this_.VALUE_ as VALUE3_6_0_
                                  from
                                      JBPM4_PROPERTY this_
                                  where
                                      this_.KEY_=?

                               

                              Hibernate:
                                  select
                                      propertyim0_.KEY_ as KEY1_6_,
                                      propertyim0_.VERSION_ as VERSION2_6_,
                                      propertyim0_.VALUE_ as VALUE3_6_
                                  from
                                      JBPM4_PROPERTY propertyim0_
                                  where
                                      propertyim0_.KEY_='next.dbid'

                               

                              Do you see something wrong ?

                               

                              Thanks in advance.

                              Stefano

                              • 12. Re: JBPM 4.3 - org.jbpm.api.JbpmException: couldn't acquire block of ids
                                swiderski.maciej

                                Hi,

                                 

                                what does return following query on your data base:

                                 

                                     select
                                        propertyim0_.KEY_ as KEY1_6_,
                                         propertyim0_.VERSION_ as VERSION2_6_,
                                        propertyim0_.VALUE_ as  VALUE3_6_ 
                                    from
                                        JBPM4_PROPERTY propertyim0_ 
                                

                                It should return two rows, one for db.version and second for next.dbid.

                                 

                                If you don't have it I would recommend to drop your jbpm schema and create it once again. Please use ant tasks for that that are delivered with jBPM distribution.

                                 

                                drop.jbpm.schema -Ddatabase=postgresql
                                

                                 

                                create.jbpm.schema -Ddatabase=postgresql
                                

                                create.jbpm.schema task will insert all required items into that table.

                                 

                                HTH

                                Maciej

                                • 13. Re: JBPM 4.3 - org.jbpm.api.JbpmException: couldn't acquire block of ids

                                  Thanks !!

                                  I have done what you suggest, the first deploy go ok , but when jbpm restart the problem emerge newely ... I cannot undertand where jbpm insert o delete these rows.

                                   

                                  Bye

                                  Stefano

                                  • 14. Re: JBPM 4.3 - org.jbpm.api.JbpmException: couldn't acquire block of ids
                                    swiderski.maciej

                                    Look for delete statements for that table when you are performing deployments.

                                     

                                    You could try to deploy your processes using ant task that is part of examples of jBPM.

                                     

                                    Cheers,

                                    Maciej

                                    1 2 3 Previous Next