5 Replies Latest reply on Dec 25, 2009 7:30 PM by Ronald van Kuijk

    Exception: couldn't acquire block of ids while deploying process

    Vladimir Penkov Newbie

      I use jbpm4 + spring integration in jboss-4.0.4.GA.

      I use embedded hsqldb for jbpm hibernate:

      <?xml version="1.0" encoding="UTF-8"?>
      
      <datasources>
      
         <local-tx-datasource>
            <jndi-name>jbpm-ds</jndi-name>
            <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}jbpmDB</connection-url>
            <driver-class>org.hsqldb.jdbcDriver</driver-class>
            <user-name>sa</user-name>
            <password></password>
            <min-pool-size>1</min-pool-size>
            <max-pool-size>5</max-pool-size>
            <idle-timeout-minutes>0</idle-timeout-minutes>
            <track-statements/>
            <!--
            <security-domain>HsqlDbRealm</security-domain>
            -->
            <prepared-statement-cache-size>32</prepared-statement-cache-size>
            <metadata><type-mapping>Hypersonic SQL</type-mapping></metadata>
            <depends>jboss:service=Hypersonic,database=jbpmDB</depends>
         </local-tx-datasource>
      
         <mbean code="org.jboss.jdbc.HypersonicDatabase"
           name="jboss:service=Hypersonic,database=jbpmDB">
           <attribute name="Database">jbpmDB</attribute>
           <attribute name="InProcessMode">true</attribute>
         </mbean>
      
      </datasources>
      
      

       

      <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns="http://www.springframework.org/schema/beans"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:context="http://www.springframework.org/schema/context"
             xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
      
      
          <bean id="jbpmDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
              <property name="jndiTemplate" ref="jndiTemplate"/>
              <property name="jndiName" value="java:/jbpm-ds"/>
          </bean>
      
          <bean id="jbpmSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
              <property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration"/>
              <property name="configLocation" value="hibernate.cfg.xml"/>
              <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>
              <property name="dataSource" ref="jbpmDataSource"/>
          </bean>
      
      </beans>
      

       

      When I try to deploy process:

       

          @PostConstruct
          public void setupProcessDefinitions() {
              for (String processDefinition : processDefinitions) {
                  NewDeployment deployment = repositoryService.createDeployment();
                  deployment.addResourceFromClasspath(processDefinition);
                  deployment.deploy();
              }
          }
      
      

       

      i recieve

      Caused by: 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.spring.CommandTransactionCallback.doInTransaction(CommandTransactionCallback.java:50)
          at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)
          at org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:77)
          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 workflow.WorkflowService.setupProcessDefinitions(WorkflowService.java:50)
      
      

       

       

       

      using debug, I see that this is because

       

      package org.jbpm.pvm.internal.id;
      ...
      public class AcquireDbidBlockCmd implements Command<Long> {
      ...
        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();
          
          String nextIdText = property.getValue();
      
      

      this query returns null. (This table contains no records at all)

       

      But all thing works when I use Mysql with InnoDB.

       

      How can I resolve this issue?