cancel
Showing results for 
Search instead for 
Did you mean: 

Error in postgres database initialization in activiti-explorer

danilo1
Champ in-the-making
Champ in-the-making
I need to run a copy of activiti explorer under postgres and jboss7, to start from a clean database I delete and recreate by hand the activiti database itself.
If I use activiti via code in my project (including the activiti-engine dependencies) it works fine (creating related schema and tables).
If I try to deploy  the modified activiti-engine.war in jboss an error is raised.
For initialize the database I have be obliged to extract the initialization "postgres sql files" from the war and run them by hand.

By logs seems that the deploy stops because the postgres objects in the database do not exist, but the databaseSchemaUpdate is set to true and, by documentation,  the schema have to be created if needs.

Is it a bug or I have to set anything in the configuration files?

Thanks in advance for each suggestion.


Here are same infos:
- Postgres 9.2
- Jboss 7.1.3
- modified db.properties:
****************
db=postgres
jdbc.driver=org.postgresql.Driver
jdbc.url=jdbcSmiley Tongueostgresql://localhost:5432/activiti
jdbc.username=postgres
jdbc.password=manager
****************

- the activiti-standalone-context.xm is unmodified and related section is :
****************
   <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
      <property name="dataSource" ref="dataSource" />
      <property name="transactionManager" ref="transactionManager" />
      <property name="databaseSchemaUpdate" value="true" />
      <property name="jobExecutorActivate" value="true" />
      <property name="customFormTypes">
         <list>
            <bean class="org.activiti.explorer.form.UserFormType" />
            <bean class="org.activiti.explorer.form.ProcessDefinitionFormType" />
            <bean class="org.activiti.explorer.form.MonthFormType" />
         </list>
      </property>
   </bean>
****************


Raised error in jboss log (setting an highest log level):
****************
08:04:36,778 ERROR [org.activiti.engine.impl.interceptor.CommandContext] (Thread-86) Error while closing command context: org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  Cause: org.postgresql.util.PSQLException: ERROR: relation "act_ru_job" does not exist
  Position: 36
### The error may exist in org/activiti/db/mapping/entity/Job.xml
### The error may involve org.activiti.engine.impl.persistence.entity.JobEntity.selectNextJobsToExecute-Inline
### The error occurred while setting parameters
### SQL: select       RES.*            from ACT_RU_JOB RES          LEFT OUTER JOIN ACT_RU_EXECUTION PI ON PI.ID_ = RES.PROCESS_INSTANCE_ID_     where (RES.RETRIES_ > 0)       and (RES.DUEDATE_ is null or RES.DUEDATE_ < ?)       and (RES.LOCK_OWNER_ is null or RES.LOCK_EXP_TIME_ < ?)    and (         (RES.EXECUTION_ID_ is null)      or       (PI.SUSPENSION_STATE_ = 1)       )       LIMIT ? OFFSET ?
### Cause: org.postgresql.util.PSQLException: ERROR: relation "act_ru_job" does not exist
  Position: 36
   at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23) [mybatis-3.2.2.jar:3.2.2]
   at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:107) [mybatis-3.2.2.jar:3.2.2]
   at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:98) [mybatis-3.2.2.jar:3.2.2]
   at org.activiti.engine.impl.db.DbSqlSession.selectListWithRawParameter(DbSqlSession.java:286) [activiti-engine-5.14.jar:5.14]
   at org.activiti.engine.impl.db.DbSqlSession.selectList(DbSqlSession.java:277) [activiti-engine-5.14.jar:5.14]
   at org.activiti.engine.impl.db.DbSqlSession.selectList(DbSqlSession.java:272) [activiti-engine-5.14.jar:5.14]
   at org.activiti.engine.impl.db.DbSqlSession.selectList(DbSqlSession.java:259) [activiti-engine-5.14.jar:5.14]
   at org.activiti.engine.impl.persistence.entity.JobEntityManager.findNextJobsToExecute(JobEntityManager.java:105) [activiti-engine-5.14.jar:5.14]
   at org.activiti.engine.impl.cmd.AcquireJobsCmd.execute(AcquireJobsCmd.java:48) [activiti-engine-5.14.jar:5.14]
   at org.activiti.engine.impl.cmd.AcquireJobsCmd.execute(AcquireJobsCmd.java:33) [activiti-engine-5.14.jar:5.14]
   at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24) [activiti-engine-5.14.jar:5.14]
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57) [activiti-engine-5.14.jar:5.14]
   at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47) [activiti-spring-5.14.jar:5.14]
   at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130) [spring-tx-3.1.2.RELEASE.jar:3.1.2.RELEASE]
   at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45) [activiti-spring-5.14.jar:5.14]
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31) [activiti-engine-5.14.jar:5.14]
   at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40) [activiti-engine-5.14.jar:5.14]
   at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35) [activiti-engine-5.14.jar:5.14]
   at org.activiti.engine.impl.jobexecutor.AcquireJobsRunnable.run(AcquireJobsRunnable.java:59) [activiti-engine-5.14.jar:5.14]
   at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]
Caused by: org.postgresql.util.PSQLException: ERROR: relation "act_ru_job" does not exist
2 REPLIES 2

jbarrez
Star Contributor
Star Contributor
The sql files for each database are also contained in the zip file downloadable from activiti.org. Did you try those?

But if databaseSchemaUpdate is set to true, it should update UNLESS the running of the SQL has failed somewhere in between.

So I should first try with the sql files from the website, and if still failure, check the logging on debug level to see if the schema update is happening or not (there should be a log line)

danilo1
Champ in-the-making
Champ in-the-making
I will check it.

Thank you.