Activiti
  1. Activiti
  2. ACT-920

ActivityException thrown on ProcessEngineConfiguration.buildProcessEngine()

    Details

    • Testcase included:
      yes
    • Number of attachments :
      1

      Description

      Application creates a process engine won't start because of a configuration issue of history level.

      Reproduction:

      • Database tables created by bundled postgres scripts (org\activiti\db\create\activiti.postgres.create.*.sql).
      • There is no record in act_ge_property with name_ = 'historyLevel'.
      • Developing application with the following configuration:
        final ProcessEngine processEngine = ProcessEngineConfiguration
                        .createStandaloneProcessEngineConfiguration()
                        .setHistory(ProcessEngineConfiguration.HISTORY_ACTIVITY)
                        .setDatabaseType("postgres")
                        .setDataSource(dataSource).buildProcessEngine();
      • On application start the following exception came:
        [#|2011-09-05T18:53:45.011+0200|SEVERE|glassfish3.1.1|org.activiti.engine.impl.interceptor.CommandContext|_ThreadID=17;_ThreadName=Thread-2;|Error while closing command context
        org.activiti.engine.ActivitiException: Activiti database problem: no historyLevel property specified
                at org.activiti.engine.impl.db.DbSqlSession.dbSchemaCheckVersion(DbSqlSession.java:510)
                at org.activiti.engine.impl.db.DbSqlSession.performSchemaOperationsProcessEngineBuild(DbSqlSession.java:882)
                at org.activiti.engine.impl.SchemaOperationsProcessEngineBuild.execute(SchemaOperationsProcessEngineBuild.java:25)
                at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
                at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
                at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
                at org.activiti.engine.impl.ProcessEngineImpl.<init>(ProcessEngineImpl.java:77)
                at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:270)
                at activiti.test.impl.Activator.start(Activator.java:28)
        

      Supposed location of the bug:
      The root of this problem might be in org.activiti.engine.impl.db.DbSqlSession.dbSchemaCheckVersion() method, on lines 492-511:

            Integer configuredHistoryLevel = Context.getProcessEngineConfiguration().getHistoryLevel();
            PropertyEntity historyLevelProperty = selectById(PropertyEntity.class, "historyLevel");
            if (historyLevelProperty==null) {
              if (errorMessage==null) {
                errorMessage = "";
              }
              errorMessage += "no historyLevel property specified";
            } else {
              Integer databaseHistoryLevel = new Integer(historyLevelProperty.getValue());
              if (!configuredHistoryLevel.equals(databaseHistoryLevel)) {
                if (errorMessage==null) {
                  errorMessage = "";
                }
                errorMessage += "historyLevel mismatch: configuration says "+configuredHistoryLevel+" and database says "+databaseHistoryLevel;
              }
            }
            
            if (errorMessage!=null) {
              throw new ActivitiException("Activiti database problem: "+errorMessage);
            }
      

      It always checks the 'historyLevel' property in the database and if it is not there the before mentioned exception will be thrown, whether or not the history level property of ProcessEngineConfigurationImpl is set.

      Local quickfix:
      Quick (and dirty) solution was to insert the ("historyLevel";"1";1) record directly into the act_ge_property table of the database. It is dirty because the lines of dbSchemaCheckVersion() above checks if the property value is same in the config and in the db. So if i reconfigure the ProcessEngine, i will have to alter the data in the db manually too.

      Possible solution:
      I assume the modification of the quoted lines of the source code of the activiti engine is required to solve this issue.

        Issue Links

          Activity

          Hide
          Ronald van Kuijk added a comment -

          Could you make the subject more specific. It is very generic now

          Show
          Ronald van Kuijk added a comment - Could you make the subject more specific. It is very generic now
          Hide
          Péter Ungvári added a comment -

          ActivityException thrown on ProcessEngineConfiguration.buildProcessEngine()

          Show
          Péter Ungvári added a comment - ActivityException thrown on ProcessEngineConfiguration.buildProcessEngine()
          Hide
          Ronald van Kuijk added a comment -

          hahaha and you might have changed it instead of just commenting

          Show
          Ronald van Kuijk added a comment - hahaha and you might have changed it instead of just commenting
          Hide
          Péter Ungvári added a comment -

          Right, actually it was my intent, but I could not find a way to edit the issue. Can you please tell me how can I?

          Show
          Péter Ungvári added a comment - Right, actually it was my intent, but I could not find a way to edit the issue. Can you please tell me how can I?
          Hide
          Ronald van Kuijk added a comment -

          might be that you do not have the rights to do that. I changed it. Not 100% happy with it but much better. thx

          Show
          Ronald van Kuijk added a comment - might be that you do not have the rights to do that. I changed it. Not 100% happy with it but much better. thx
          Hide
          Jorg Heymans added a comment -

          experiencing the same issue with 5.8. I dropped all the ACT_* tables, recreated them from source scripts in jar (oracle) and ran my unit tests:

          11:39:56,301 WARN [atomikos] - XADBMS-1: refreshed XAResource
          11:39:57,458 DEBUG [org.apache.ibatis.logging.LogFactory] - Logging initialized using 'org.apache.ibatis.logging.slf4j.Slf4jImpl' adapter.
          11:39:57,520 DEBUG [java.sql.Connection] - ooo Connection Opened
          11:39:57,754 DEBUG [java.sql.PreparedStatement] - ==>  Executing: select VALUE_ from ACT_GE_PROPERTY where NAME_ = 'schema.version' 
          11:39:57,754 DEBUG [java.sql.PreparedStatement] - ==> Parameters: 
          11:39:57,770 DEBUG [java.sql.ResultSet] - <==    Columns: VALUE_
          11:39:57,770 DEBUG [java.sql.ResultSet] - <==        Row: 5.8
          11:39:57,801 DEBUG [java.sql.PreparedStatement] - ==>  Executing: select * from ACT_GE_PROPERTY where NAME_ = ? 
          11:39:57,801 DEBUG [java.sql.PreparedStatement] - ==> Parameters: historyLevel(String)
          07-Nov-2011 11:39:57 org.activiti.engine.impl.interceptor.CommandContext close
          SEVERE: Error while closing command context
          org.activiti.engine.ActivitiException: Activiti database problem: no historyLevel property specified
          	at org.activiti.engine.impl.db.DbSqlSession.dbSchemaCheckVersion(DbSqlSession.java:510)
          	at org.activiti.engine.impl.db.DbSqlSession.performSchemaOperationsProcessEngineBuild(DbSqlSession.java:882)
          	at org.activiti.engine.impl.SchemaOperationsProcessEngineBuild.execute(SchemaOperationsProcessEngineBuild.java:25)
          
          Show
          Jorg Heymans added a comment - experiencing the same issue with 5.8. I dropped all the ACT_* tables, recreated them from source scripts in jar (oracle) and ran my unit tests: 11:39:56,301 WARN [atomikos] - XADBMS-1: refreshed XAResource 11:39:57,458 DEBUG [org.apache.ibatis.logging.LogFactory] - Logging initialized using 'org.apache.ibatis.logging.slf4j.Slf4jImpl' adapter. 11:39:57,520 DEBUG [java.sql.Connection] - ooo Connection Opened 11:39:57,754 DEBUG [java.sql.PreparedStatement] - ==> Executing: select VALUE_ from ACT_GE_PROPERTY where NAME_ = 'schema.version' 11:39:57,754 DEBUG [java.sql.PreparedStatement] - ==> Parameters: 11:39:57,770 DEBUG [java.sql.ResultSet] - <== Columns: VALUE_ 11:39:57,770 DEBUG [java.sql.ResultSet] - <== Row: 5.8 11:39:57,801 DEBUG [java.sql.PreparedStatement] - ==> Executing: select * from ACT_GE_PROPERTY where NAME_ = ? 11:39:57,801 DEBUG [java.sql.PreparedStatement] - ==> Parameters: historyLevel( String ) 07-Nov-2011 11:39:57 org.activiti.engine.impl.interceptor.CommandContext close SEVERE: Error while closing command context org.activiti.engine.ActivitiException: Activiti database problem: no historyLevel property specified at org.activiti.engine.impl.db.DbSqlSession.dbSchemaCheckVersion(DbSqlSession.java:510) at org.activiti.engine.impl.db.DbSqlSession.performSchemaOperationsProcessEngineBuild(DbSqlSession.java:882) at org.activiti.engine.impl.SchemaOperationsProcessEngineBuild.execute(SchemaOperationsProcessEngineBuild.java:25)
          Hide
          Sherlock Qiao added a comment - - edited

          I can reproduce this issue on 5.8 every time I dropped all tables and create them manually by sql scripts.

          Show
          Sherlock Qiao added a comment - - edited I can reproduce this issue on 5.8 every time I dropped all tables and create them manually by sql scripts.
          Hide
          Anette Engel added a comment - - edited

          I also get an ActivitiException:

           
          
          org.activiti.engine.ActivitiException: Activiti database problem: no historyLevel property specified
          	at org.activiti.engine.impl.db.DbSqlSession.dbSchemaCheckVersion(DbSqlSession.java:510)
          	at org.activiti.engine.impl.db.DbSqlSession.performSchemaOperationsProcessEngineBuild(DbSqlSession.java:882)
          	at org.activiti.engine.impl.SchemaOperationsProcessEngineBuild.execute(SchemaOperationsProcessEngineBuild.java:25)
          	at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
          	at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
          

          I don't get the ActivitiException with the the following configuration:

           
           <bean id="processEngineConfiguration"
                class="org.activiti.spring.SpringProcessEngineConfiguration">
          
                 <property name="history" value="full" />
                 <property name="databaseSchemaUpdate" value="false" />
          
          

          However, when I change the property databaseSchemaUpdate to false:

           
          <property name="databaseSchemaUpdate" value="false" />
          

          or remove the property, the above ActivitiException is thrown.

          My problem: I don't want the Database schema automatically be updated.

          Show
          Anette Engel added a comment - - edited I also get an ActivitiException: org.activiti.engine.ActivitiException: Activiti database problem: no historyLevel property specified at org.activiti.engine.impl.db.DbSqlSession.dbSchemaCheckVersion(DbSqlSession.java:510) at org.activiti.engine.impl.db.DbSqlSession.performSchemaOperationsProcessEngineBuild(DbSqlSession.java:882) at org.activiti.engine.impl.SchemaOperationsProcessEngineBuild.execute(SchemaOperationsProcessEngineBuild.java:25) at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24) at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42) I don't get the ActivitiException with the the following configuration: <bean id= "processEngineConfiguration" class= "org.activiti.spring.SpringProcessEngineConfiguration" > <property name= "history" value= "full" /> <property name= "databaseSchemaUpdate" value= "false" /> However, when I change the property databaseSchemaUpdate to false: <property name= "databaseSchemaUpdate" value= "false" /> or remove the property, the above ActivitiException is thrown. My problem: I don't want the Database schema automatically be updated.
          Hide
          Ronald van Kuijk added a comment -

          We currently ran into this as well. Will try to patch this for 5.10...

          Show
          Ronald van Kuijk added a comment - We currently ran into this as well. Will try to patch this for 5.10...
          Hide
          Jorg Heymans added a comment - - edited

          i think the best fix would be to not hardcode the historylevel in the database but obtain it from the process engine configuration. This is slightly related i guess http://forums.activiti.org/en/viewtopic.php?f=6&t=3893

          Show
          Jorg Heymans added a comment - - edited i think the best fix would be to not hardcode the historylevel in the database but obtain it from the process engine configuration. This is slightly related i guess http://forums.activiti.org/en/viewtopic.php?f=6&t=3893
          Hide
          Ronald van Kuijk added a comment -

          That part is not what I want to fix. I just want to fix the issue where you have 'history none' but the engine requires a property in the database. No property present is equal to 'history-none'

          Show
          Ronald van Kuijk added a comment - That part is not what I want to fix. I just want to fix the issue where you have 'history none' but the engine requires a property in the database. No property present is equal to 'history-none'
          Hide
          Tom Baeyens added a comment -

          I've looked at the schema files versions 5.8 and 5.10 for oracle. modules/activiti-engine/src/main/resources/org/activiti/db/create/activiti.oracle.create.engine.sql
          Those files start with

          create table ACT_GE_PROPERTY (
              NAME_ NVARCHAR2(64),
              VALUE_ NVARCHAR2(300),
              REV_ INTEGER,
              primary key (NAME_)
          );
          
          insert into ACT_GE_PROPERTY
          values ('schema.version', '5.8', 1);
          
          insert into ACT_GE_PROPERTY
          values ('schema.history', 'create(5.8)', 1);
          
          insert into ACT_GE_PROPERTY
          values ('next.dbid', '1', 1);
          
          ...
          

          So I don't understand how you created the schema and not have that property in your ACT_GE_PROPERTY table. Can someone explain?

          Show
          Tom Baeyens added a comment - I've looked at the schema files versions 5.8 and 5.10 for oracle. modules/activiti-engine/src/main/resources/org/activiti/db/create/activiti.oracle.create.engine.sql Those files start with create table ACT_GE_PROPERTY ( NAME_ NVARCHAR2(64), VALUE_ NVARCHAR2(300), REV_ INTEGER, primary key (NAME_) ); insert into ACT_GE_PROPERTY values ('schema.version', '5.8', 1); insert into ACT_GE_PROPERTY values ('schema.history', 'create(5.8)', 1); insert into ACT_GE_PROPERTY values ('next.dbid', '1', 1); ... So I don't understand how you created the schema and not have that property in your ACT_GE_PROPERTY table. Can someone explain?
          Show
          Jorg Heymans added a comment - related http://forums.activiti.org/en/viewtopic.php?f=4&t=3597
          Hide
          Tom Baeyens added a comment -

          i now saw that the historyLevel property is not in the schema files. So my comment above is not really valid

          i'll investigate

          Show
          Tom Baeyens added a comment - i now saw that the historyLevel property is not in the schema files. So my comment above is not really valid i'll investigate
          Hide
          Rico Apfelbeck added a comment -

          The database value and the configuration value are availible at the related source code position. If the database value is empty I'd suggest using the configured default instead of failing the check. Maybe you can then also write the configured default in the database. The check should only fail if the database value is present and different from the configured value.

          Show
          Rico Apfelbeck added a comment - The database value and the configuration value are availible at the related source code position. If the database value is empty I'd suggest using the configured default instead of failing the check. Maybe you can then also write the configured default in the database. The check should only fail if the database value is present and different from the configured value.
          Hide
          Tom Baeyens added a comment -

          The historyLevel property is removed from the DB. Only the value configured in the configuration file will be taken into account.

          Show
          Tom Baeyens added a comment - The historyLevel property is removed from the DB. Only the value configured in the configuration file will be taken into account.

            People

            • Assignee:
              Frederik Heremans
              Reporter:
              Péter Ungvári
            • Votes:
              3 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: