cancel
Showing results for 
Search instead for 
Did you mean: 

Spring boot with Activiti Example along with MySQL

harishkadamudi
Champ in-the-making
Champ in-the-making
Hi there,
I am following the code committed by jbarrez, git link mentioned below.
https://github.com/jbarrez/spring-boot-with-activiti-example

I have query here, i am trying to connect the above code with mysql. I tried having MAVEN dependency of MYSQL along with related changes in application.properties file but no success.
Could you please help me on this.

The only change being to the pom is adding mysql dependency.
                 <dependency>
         <groupId>mysql</groupId>
         <artifactId>mysql-connector-java</artifactId>
      </dependency>

application.properties file

# ===============================
# = DATA SOURCE
# ===============================

# Set here configurations for the database connection

# Connection url for the database
spring.datasource.url = jdbc:mysql://localhost:3306/activiti?useSSL=false

# Username and password
spring.datasource.username = root
spring.datasource.password = root

# Keep the connection alive if idle for a long time (needed in production)
spring.datasource.testWhileIdle = true
spring.datasource.validationQuery = SELECT 1

# ===============================
# = JPA / HIBERNATE
# ===============================

# Use spring.jpa.properties.* for Hibernate native properties (the prefix is
# stripped before adding them to the entity manager).

# Show or not log for each sql query
spring.jpa.show-sql = true

# Hibernate ddl auto (create, create-drop, update): with "update" the database
# schema will be automatically updated accordingly to java entities found in
# the project
spring.jpa.hibernate.ddl-auto = create-drop

# Naming strategy
spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy

# Allows Hibernate to generate SQL optimized for a particular DBMS
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
3 REPLIES 3

harishkadamudi
Champ in-the-making
Champ in-the-making
When i tried above configuration i got exception stating "Could not update Activiti database schema: unknown version from database: '5.21.0.0'". If there is a mismatch in configuration would like to know what are the correct version numbers.

Note: I am using activiti-5.21.0 war file

harishkadamudi
Champ in-the-making
Champ in-the-making
I changed activiti version to 5.21.0 in application properties file. After running i greeted with below Exception
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'user' for key 'PRIMARY'

jbarrez
Star Contributor
Star Contributor
> Note: I am using activiti-5.21.0 war file

Not sure I'm following. You're running Spring Boot _and_ explorer? How are you doing that? Afaik, Spring Boot doesn't run Explorer.