1 2 3 Previous Next 30 Replies Latest reply on Mar 25, 2011 4:31 PM by t-9000 Go to original post
      • 15. Re: JBPM 4.3 - org.jbpm.api.JbpmException: couldn't acquire block of ids

        Unfortunately my build process is not ant based ... but maven based. I'm going to read ant tasks sources to understand the differences ...

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

          you can use ant task within your maven setup, just utilize ant-run plugin

           

          /Maciej

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

            Ant task Java code is the same as that I'm using. Also I'm change hibernate.hbm2ddl.auto=update => hibernate.hbm2ddl.auto=create-drop to mimic the same beaviour.

             

            But the same error get up.

             

            It is strage, in unit tests if i run only one test all is ok; if I run more tests the JbpmException emerge. My unit tests deploy in setup and run tests on workflow ...

             

            Very strange.... sometimes jbpm found properties in the db and sometimes do not find ...

             

            Disarmed

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

              Somehow these rows are removed from the data base.

               

              Have you checked if there are any delete statements printed out by hibernate while executing your tests?

               

              Take a look at source code for JbpmTestCase, perhaps there will be some ideas to try out.

               

              /Maciej

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

                I just found this as well, perhaps will be useful

                http://community.jboss.org/message/517788

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

                  Maciej "Have you checked if there are any delete statements printed out by hibernate while executing your tests? "

                   

                  Yes, I cannot see this kind of statements.

                   

                  Maciej "Take a look at source code for JbpmTestCase, perhaps there will be some ideas to try out. "

                   

                  Yes, this was the first place where I have copied the approach.

                   

                  Thanks Maciej for the support !!

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

                    Maciej  "I just found this as well, perhaps will be useful , http://community.jboss.org/message/517788 "

                    Yes I have read and applied this suggestions before posting here, thank you.

                     

                    I'm disarmed going to evaluate Drools Flow and I hope this framework works ...

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

                      Hi guys, I'm back ... with new energies :-)

                       

                      The problem was related to

                      org.jbpm.pvm.internal.id.DatabaseDbidGenerator and precisely on AcquireDbidBlockCmd it use.
                      I have re-implmented these classes using sequence to generate ids, as below:
                      ...
                      public class SequenceDbIdGenerator extends DbidGenerator {   
                          CommandService commandService;
                         
                          @Override
                          public long getNextId() {
                              return commandService.execute(new SequenceDbIdGeneratorCmd());
                          }
                      }
                      ...

                      and
                      ...
                      public class SequenceDbIdGeneratorCmd implements Command<Long> {
                          private static final long serialVersionUID = -8109570788517494372L;

                          @SuppressWarnings("unchecked")
                          @Override
                          public Long execute(Environment environment) throws Exception {
                              Session session = environment.get(Session.class);
                              List<BigInteger> res = session.createSQLQuery(
                                      "select nextval('jbpm_seq_external_id')").list();
                              return res.get(0).longValue();
                          }
                      }

                      and i the jbpm config file:

                      ...

                      <object class="net.tinvention.wf.jbpm.SequenceDbIdGenerator">
                      <field name="commandService"><ref object="txRequiredCommandService" /></field>
                      </object>
                      <object
                      class="org.jbpm.pvm.internal.id.DatabaseIdComposer" init="eager" />

                       

                      Does anyone more expert on jbpm can validate ? Do you see any hidden disaster or this solution can work ?

                       

                      Thanks in advance

                      Stefano

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

                        You are always free to reimplement portions of the project, yet it is best to stick to what we provide out of the box to avoid maintenance problems later on.

                         

                        Setting hbm2ddl.auto does not provide the same behavior as the create.jbpm.schema target of the install ant file. In particular, it does not initialize the JBPM4_PROPERTY table. If you leave hbm2ddl.auto set to create-drop, Hibernate drops the tables when the session factory closes, recreates them when the session factory opens again, but does not initialize the JBPM4_PROPERTY table.

                         

                        When deploying jBPM or any other product on an environment other than what it provides out of the box, be careful to mimic the original environment as closely as possible.

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

                          Hi Stefano,

                           

                            Of course, you could implement your idGenerator for jBPM4.  And using sequence is the previous way of jBPM4 using.  It changed to use JBPM4_PROPERTY since jBPM-4.2.

                           

                            By the way, some days earlier, you said you will use drools flow instead.  I don't know much about it.  Did it powerful?  Did it easy to use?

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

                            Alejandro "Setting hbm2ddl.auto does not provide the same behavior as the create.jbpm.schema target of the install ant file. In particular, it does not initialize the JBPM4_PROPERTY table. If you leave hbm2ddl.auto set to create-drop, Hibernate drops the tables when the session factory closes, recreates them when the session factory opens again, but does not initialize the JBPM4_PROPERTY table.

                            When deploying jBPM or any other product on an environment other than what it provides out of the box, be careful to mimic the original environment as closely as possible."

                             

                            So if I use hbm2ddl.auto=update and the sequence is crated only once, Am I mimic the original environment ?

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

                              Huisheng "And using sequence is the previous way of jBPM4 using.  It changed to use JBPM4_PROPERTY since jBPM-4.2."

                               

                              Why jbpm not use hibernate id generators declared in hbm mapping files or using annotations ? My modest suggestion to get jbpm better is to use a hibernate built in portable generator as default (es. no sequence, ..) and permit the user to overwrite it with other hibernate built in generators.

                              See below here for hibernate supported built in generators ( http://docs.jboss.org/hibernate/core/3.3/reference/en/html/mapping.html#mapping-declaration-id )

                               

                              Huisheng "By the way, some days earlier, you said you will use drools flow instead.  I don't know much about it.  Did it powerful?  Did it easy to use?"

                               

                              Yes I have found it is more easy to use and setup than jbpm. Also for some aspects more advanced in functionality.

                              And as Developer I liked the complete maven management of the project sources only because We use maven in place of ant. Having dev environment working with svn sources, unit tests and so on .. is very simple.

                              I found Jbpm dev env not so easy to setup:  I tried to run jbpm sources tests using my new sequenceDatabaseGenerator , but the switch to postgresql does not work out of box ... also some maven dependencies needs to manual managed: I remember gpd and oracle driver (also I want to test against postgresql) ... more or less 2 hours without results .. also reading instructions.

                               

                              The missing feature that do not fit in our needs of drools flow, was the fact that seems not easy to navigate the process (graph) using api, for example asking the next outgoing transitions...

                              We need to present on GUI buttons to the users for go next on one branch or another of the process definitions ... I think this limits born on the fact that drools flow is rule based ... not graph based. Also Human task needs Apache Mina opening another tcp port and so on ...

                               

                              These are some advantages and disadvantages I have found in an evaluation that last 3-4 days on jbpm and drools flow, integrating in our product that is spring based. Sure having much time going deeply these opinions can be changed  ...

                               

                              ( Sorry for may bad English !! )

                               

                              Bye

                              Stefano

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

                                Hi Stefano,

                                  Thank you for your explaination.  I think drools flow is most like an automatic workflow.

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

                                  Hi guys.

                                   

                                  Now I met this error in jta environment.  When I first use the processEngine and want to do some stuff on it.  The initial job and the continues jobs are in the same jta transaction.  the inital job won't flush to database, so other operations will fail with couldn't acquire block of ids.

                                   

                                  If I let session.flush() after PropertyImpl.setNextDbid(session, 1);,  this problem could be solved.  Just thinking about whether it is the right way to do.

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

                                    Sorry, it is my mistake.  I should configure "hibernate.transaction.factory_class" in jbpm.hibernate.cfg.xml,  Now everything is OK.