cancel
Showing results for 
Search instead for 
Did you mean: 

How to use REST API with activiti-app?

k82cn
Champ in-the-making
Champ in-the-making

There's a activiti-app had been deployed in my cluster, I'd like to do some operation with REAT API to this app, how can I do this? what's the endpoints of that?

33 REPLIES 33

k82cn
Champ in-the-making
Champ in-the-making

What should I change? I'm using the default configuration:

# demo data properties
create.demo.users=true
create.demo.definitions=true
create.demo.models=true

# engine properties
engine.schema.update=true
engine.activate.jobexecutor=false
engine.asyncexecutor.enabled=true
engine.asyncexecutor.activate=true
engine.history.level=full

# rest properties

# Enable/disable Java serializable objects to be passed as variables in the REST API.
rest.variables.allow.serializable=true

# Enable/disable whether the docs are available on /docs
rest.docs.swagger.enabled=true

fcorti
Elite Collaborator
Elite Collaborator

Most of the times, the DB access is the issue.
Please check the db.properties file (in the same folder where you find the engine.properties file) has the same DB settings of the admin-app.war application.

k82cn
Champ in-the-making
Champ in-the-making

BTW, do activit-app and activiti-rest share data? It seem they're using different database.

fcorti
Elite Collaborator
Elite Collaborator

Indeed, they have to point on the same DB.
Most of the times this is the issue.

k82cn
Champ in-the-making
Champ in-the-making

great, let me try it again Smiley Happy.

k82cn
Champ in-the-making
Champ in-the-making

If I point to the same database, I got following errors:

INFO 9/20/17 2:06 AM:liquibase: classpath:META-INF/liquibase/db-changelog.xml: 1::activiti: Table USER_AUTHORITY created
SEVERE 9/20/17 2:06 AM:liquibase: classpath:META-INF/liquibase/db-changelog.xml: 1::activiti: Change Set classpath:META-INF/liquibase/db-changelog.xml::1::activiti failed. Error: Error executing SQL CREATE TABLE activiti.HIBERNATE_SEQUENCES (sequence_name VARCHAR(255) NULL, sequence_next_hi_value INT NULL): Table 'hibernate_sequences' already exists
liquibase.exception.DatabaseException: Error executing SQL CREATE TABLE activiti.HIBERNATE_SEQUENCES (sequence_name VARCHAR(255) NULL, sequence_next_hi_value INT NULL): Table 'hibernate_sequences' already exists
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:61)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:106)
at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1189)
at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1172)
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:352)
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:40)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:64)
at liquibase.Liquibase.update(Liquibase.java:202)
at liquibase.Liquibase.update(Liquibase.java:181)
at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:342)
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:299)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1633)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)

k82cn
Champ in-the-making
Champ in-the-making

Also user_info Smiley Sad.

activiti_1 | org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class com.activiti.conf.DatabaseConfiguration: Invocation of init method failed; nested exception is liquibase.exception.MigrationFailedException: Migration failed for change set classpath:META-INF/liquibase/db-changelog.xml::1::activiti:
activiti_1 | Reason: liquibase.exception.DatabaseException: Error executing SQL CREATE TABLE activiti.USER_INFO (login VARCHAR(50) NOT NULL, password VARCHAR(100) NULL, first_name VARCHAR(50) NULL, last_name VARCHAR(50) NULL, email VARCHAR(100) NULL, CONSTRAINT PK_USER_INFO PRIMARY KEY (login)): Table 'user_info' already exists
activiti_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
activiti_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
activiti_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
activiti_1 | at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
activiti_1 | at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
activiti_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
activiti_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
activiti_1 | at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)
activiti_1 | at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
activiti_1 | at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
activiti_1 | at com.activiti.conf.WebConfigurer.contextInitialized(WebConfigurer.java:46)
activiti_1 | at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745)
activiti_1 | at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207)
activiti_1 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
activiti_1 | at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
activiti_1 | at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
activiti_1 | at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
activiti_1 | at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1144)
activiti_1 | at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1878)
activiti_1 | at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
activiti_1 | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
activiti_1 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
activiti_1 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
activiti_1 | at java.lang.Thread.run(Thread.java:748)
activiti_1 | Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set classpath:META-INF/liquibase/db-changelog.xml::1::activiti:
activiti_1 | Reason: liquibase.exception.DatabaseException: Error executing SQL CREATE TABLE activiti.USER_INFO (login VARCHAR(50) NOT NULL, password VARCHAR(100) NULL, first_name VARCHAR(50) NULL, last_name VARCHAR(50) NULL, email VARCHAR(100) NULL, CONSTRAINT PK_USER_INFO PRIMARY KEY (login)): Table 'user_info' already exists
activiti_1 | at liquibase.changelog.ChangeSet.execute(ChangeSet.java:388)
activiti_1 | at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:40)
activiti_1 | at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:64)
activiti_1 | at liquibase.Liquibase.update(Liquibase.java:202)
activiti_1 | at liquibase.Liquibase.update(Liquibase.java:181)
activiti_1 | at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:342)
activiti_1 | at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:299)

fcorti
Elite Collaborator
Elite Collaborator

Which DB are you using?
I suggest to use MySql or PostgreSql, not the inmemory database because it won't work with it. 

k82cn
Champ in-the-making
Champ in-the-making

Yes, I'm using MySQL.

k82cn
Champ in-the-making
Champ in-the-making

Anyway, my original request to use activiti-app, and can use script to create/query process instance in it.