cancel
Showing results for 
Search instead for 
Did you mean: 

Is the Activiti QuickStart example not working or out of date

matykiewicz
Champ in-the-making
Champ in-the-making

I am working through the QuickStart guide (Quick Start Guide | Activiti.org )and I get a runtime error. I did not see any issue in Jira. I thought I'd ask if someone can spot the error or give me a better quickstart. Here most of the info:

The error (more detail below):

Exception in thread "main" org.activiti.engine.ActivitiException: Error while building ibatis SqlSessionFactory: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Unknown element <bind> in SQL statement.

My setup:

Linux Mint 18, Oracle JDK1.8.0

Activiti 5.22.0

Here's the pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.activiti</groupId>
<artifactId>ActivitiDeveloperQuickStart</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>ActivitiDeveloperQuickStart</name>
<url>http://maven.apache.org</url>


<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-engine</artifactId>
<version>5.22.0</version>
</dependency>

<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-image-generator</artifactId>
<version>5.22.0</version>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-bpmn-converter</artifactId>
<version>5.22.0</version>
</dependency>

<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring</artifactId>
<version>5.22.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.21</version>
</dependency>

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.193</version>
</dependency>

<dependency>
<groupId>org.apache.ibatis</groupId>
<artifactId>ibatis-core</artifactId>
<version>3.0</version>
</dependency>
<!--
<dependency>
<groupId>org.apache.ibatis</groupId>
<artifactId>ibatis-sqlmap</artifactId>
<version>3.0-beta-10</version>
</dependency>
-->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.2.5</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.7</version>
</dependency>

</dependencies>


<build>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4.1</version>

<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.example.OnboardingRequest</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>

</plugin>
</plugins>

</build>

</project>

I used the example source and log4j. properties from the QuickStart page, and here's the main class to be sure:

package com.example;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration;
import org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration;

public class OnboardingRequest {

public static void main(String[] args) {
ProcessEngineConfiguration cfg = new StandaloneProcessEngineConfiguration()
.setJdbcUrl("jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000")
.setJdbcUsername("sa")
.setJdbcPassword("")
.setJdbcDriver("org.h2.Driver")
.setDatabaseSchema(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);

ProcessEngine processEngine = cfg.buildProcessEngine();
String pName = processEngine.getName();
String ver = processEngine.VERSION;

System.out.println("ProcessEngine ["+pName+"] Version: ["+ver+"]");

}

}

The project compiles and packages fine, and adding the dependencies fixed all the NoClassFound Exceptions. Here's the full runtime error:

-------
 /scratch/java/activiti/ActivitiDeveloperQuickStart $ $JAVA_HOME/bin/java -jar ./target/ActivitiDeveloperQuickStart-1.0-SNAPSHOT-jar-with-dependencies.jar
02:51:45,438 [main] DEBUG org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl - initializing datasource to db: jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000
02:51:45,461 [main] DEBUG org.apache.ibatis.datasource.pooled.PooledDataSource - PooledDataSource forcefully closed/removed all connections.
02:51:45,957 [main] DEBUG org.apache.ibatis.datasource.pooled.PooledDataSource - Created connection 1898220577.
02:51:45,968 [main] DEBUG org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl - database product name: 'H2'
02:51:45,977 [main] DEBUG org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl - using database type: h2
02:51:45,978 [main] DEBUG org.apache.ibatis.datasource.pooled.PooledDataSource - Returned connection 1898220577 to pool.
Exception in thread "main" org.activiti.engine.ActivitiException: Error while building ibatis SqlSessionFactory: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Unknown element <bind> in SQL statement.
at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.initSqlSessionFactory(ProcessEngineConfigurationImpl.java:922)
at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.init(ProcessEngineConfigurationImpl.java:642)
at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:612)
at com.example.OnboardingRequest.main(OnboardingRequest.java:17)
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Unknown element <bind> in SQL statement.
at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:71)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:55)
at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.parseMybatisConfiguration(ProcessEngineConfigurationImpl.java:954)
at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.initMybatisConfiguration(ProcessEngineConfigurationImpl.java:937)
at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.initSqlSessionFactory(ProcessEngineConfigurationImpl.java:918)
... 3 more
Caused by: java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Unknown element <bind> in SQL statement.
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:59)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:39)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:247)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:69)
... 7 more
Caused by: org.apache.ibatis.builder.BuilderException: Unknown element <bind> in SQL statement.
at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseDynamicTags(XMLStatementBuilder.java:88)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.access$1100(XMLStatementBuilder.java:22)
at org.apache.ibatis.builder.xml.XMLStatementBuilder$IfHandler.handleNode(XMLStatementBuilder.java:223)
at org.apache.ibatis.builder.xml.XMLStatementBuilder$ChooseHandler.handleWhenOtherwiseNodes(XMLStatementBuilder.java:255)
at org.apache.ibatis.builder.xml.XMLStatementBuilder$ChooseHandler.handleNode(XMLStatementBuilder.java:243)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseDynamicTags(XMLStatementBuilder.java:90)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.access$1100(XMLStatementBuilder.java:22)
at org.apache.ibatis.builder.xml.XMLStatementBuilder$TrimHandler.handleNode(XMLStatementBuilder.java:177)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseDynamicTags(XMLStatementBuilder.java:90)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.access$1100(XMLStatementBuilder.java:22)
at org.apache.ibatis.builder.xml.XMLStatementBuilder$ForEachHandler.handleNode(XMLStatementBuilder.java:208)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseDynamicTags(XMLStatementBuilder.java:90)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.access$1100(XMLStatementBuilder.java:22)
at org.apache.ibatis.builder.xml.XMLStatementBuilder$TrimHandler.handleNode(XMLStatementBuilder.java:177)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseDynamicTags(XMLStatementBuilder.java:90)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.access$1100(XMLStatementBuilder.java:22)
at org.apache.ibatis.builder.xml.XMLStatementBuilder$ForEachHandler.handleNode(XMLStatementBuilder.java:208)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseDynamicTags(XMLStatementBuilder.java:90)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.access$1100(XMLStatementBuilder.java:22)
at org.apache.ibatis.builder.xml.XMLStatementBuilder$WhereHandler.handleNode(XMLStatementBuilder.java:190)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseDynamicTags(XMLStatementBuilder.java:90)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.access$1100(XMLStatementBuilder.java:22)
at org.apache.ibatis.builder.xml.XMLStatementBuilder$IncludeNodeHandler.contents(XMLStatementBuilder.java:171)
at org.apache.ibatis.builder.xml.XMLStatementBuilder$IncludeNodeHandler.handleNode(XMLStatementBuilder.java:166)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseDynamicTags(XMLStatementBuilder.java:90)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.access$1100(XMLStatementBuilder.java:22)
at org.apache.ibatis.builder.xml.XMLStatementBuilder$IncludeNodeHandler.contents(XMLStatementBuilder.java:171)
at org.apache.ibatis.builder.xml.XMLStatementBuilder$IncludeNodeHandler.handleNode(XMLStatementBuilder.java:166)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseDynamicTags(XMLStatementBuilder.java:90)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:48)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:192)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:57)
... 10 more

Thanks in advance.

James

1 ACCEPTED ANSWER

thuynh
Star Contributor
Star Contributor

Hi James Matykiewicz ,

The Activiti quick start guide is up to date and should work. It works for me.

It seems like there is something wrong during the DB creation process when the engine is created in your case. Looking at your pom.xml, I see you included the ibatis dependencies. You don't really need to do that. But that should not create any problem as well. So strange. Maybe you want to take them out and try again?

Thanks,

Thong Huynh

View answer in original post

5 REPLIES 5

thuynh
Star Contributor
Star Contributor

Hi James Matykiewicz ,

The Activiti quick start guide is up to date and should work. It works for me.

It seems like there is something wrong during the DB creation process when the engine is created in your case. Looking at your pom.xml, I see you included the ibatis dependencies. You don't really need to do that. But that should not create any problem as well. So strange. Maybe you want to take them out and try again?

Thanks,

Thong Huynh

matykiewicz
Champ in-the-making
Champ in-the-making

Thanks Thong Huynh,

Yes, removing the ibatis dependency fixed the error.  Now,  as I work through other problems, I am stuck on this one:

- If I use the default JDBC URL of "mem", no ACT_ tables are created, so I get an error like this:

[main] DEBUG org.activiti.engine.impl.persistence.entity.PropertyEntity.selectDbSchemaVersion - ==> Preparing: select VALUE_ from ACT_GE_PROPERTY where NAME_ = 'schema.version'

[main] ERROR org.activiti.engine.impl.interceptor.CommandContext - Error while closing command context
org.activiti.engine.ActivitiException: no activiti tables in db. set <property name="databaseSchemaUpdate" to value="true" or value="create-drop" (use create-drop for testing only!) in bean processEngineConfiguration in activiti.cfg.xml for automatic schema creation

Do I have to add the activiti.h2.xxx.yyy.sql files somewhere in the classpath?

I tried adding a activiti.cfg.xml to src/main/resources, but this did not fix the problem

I tried adding a db.properties file to src/main/resources, but this did not fix the problem

I tried changing the StandaloneProcessEngineConfiguration.setDatabaseSchema() to DB_SCHEMA_UPDATE_CREATE_TRUE in both the Java code and the activiti.cfg.xml  which did not work either.

To me it looks like the activiti database schema is not being loaded, so ...

I started an external H2 database, changes the JDBC URL to use tcp://localhost/~/activiti, and I manually added the engine schema to this DB, now when I run the QuickStart application, I get a different 'no tables' problem and see an error showing I did not get the table name correct:

[main] DEBUG org.activiti.engine.impl.interceptor.LogInterceptor - --- SchemaOperationsProcessEngineBuild finished --------------------------------------------------------
 [main] DEBUG org.activiti.engine.impl.interceptor.LogInterceptor -

Exception in thread "main" org.activiti.engine.ActivitiException: Activiti database problem: Tables missing for component(s) engine, history, identity
at org.activiti.engine.impl.db.DbSqlSession.dbSchemaCheckVersion(DbSqlSession.java:935)
at org.activiti.engine.impl.db.DbSqlSession.performSchemaOperationsProcessEngineBuild(DbSqlSession.java:1419)
at org.activiti.engine.impl.SchemaOperationsProcessEngineBuild.execute(SchemaOperationsProcessEngineBuild.java:27)

Hi James,

There are many different ways to invoke the Activiti process engine. The one being used in the guideline uses the StandaloneConfigure which is an extension of the ProcessEngineConfiguration. This will create the database tables when the engine is invoked. Your error logs show that no tables were created then the engine is started. So double check again in your main class to see if you have followed the instruction correctly at step 3.

public class OnboardingRequest { public static void main(String[] args) { ProcessEngineConfiguration cfg = new StandaloneProcessEngineConfiguration() .setJdbcUrl("jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000") .setJdbcUsername("sa") .setJdbcPassword("") .setJdbcDriver("org.h2.Driver") .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE); ProcessEngine processEngine = cfg.buildProcessEngine(); String pName = processEngine.getName(); String ver = ProcessEngine.VERSION; System.out.println("ProcessEngine [" + pName + "] Version: [" + ver + "]"); } }

Thanks,

Thong

 

 

matykiewicz
Champ in-the-making
Champ in-the-making

Thanks again Thong.

I am moving forward with deploying the download and using the GIT repo for

code. I was only trying to fix documentation issues. I still believe

there's a Spring configuration file or something not mentioned to point at

the SQL files. I will likely determine how the DB is created/updated as I

work through a complete deployment.

James