Hi everyone
I am facing an issue with form engine. I am trying to start a form engine , as i want to fill a form programmatically, associated with a task of a process. I use following line of code to build the form engine :
FormEngine formEngine = FormEngines.getDefaultFormEngine();
But when i run the code, i am facing error that form engine is not initialized. What does this mean and how to resolve it. Could anyone help. Thanks in advance. I have pasted below the error thrown on execution :
Exception in thread “main” org.flowable.engine.common.api.FlowableIllegalArgumentException: Form engine is not initialized
at org.flowable.engine.impl.cmd.CompleteTaskWithFormCmd.execute(CompleteTaskWithFormCmd.java:72)
at org.flowable.engine.impl.cmd.CompleteTaskWithFormCmd.execute(CompleteTaskWithFormCmd.java:38)
at org.flowable.engine.impl.cmd.NeedsActiveTaskCmd.execute(NeedsActiveTaskCmd.java:58)
at org.flowable.engine.impl.interceptor.CommandInvoker$1.run(CommandInvoker.java:51)
at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperation(CommandInvoker.java:93)
at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperations(CommandInvoker.java:72)
at org.flowable.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:56)
at org.flowable.engine.impl.interceptor.BpmnOverrideContextInterceptor.execute(BpmnOverrideContextInterceptor.java:25)
at org.flowable.engine.common.impl.interceptor.TransactionContextInterceptor.execute(TransactionContextInterceptor.java:53)
at org.flowable.engine.common.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:72)
at org.flowable.engine.common.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:36)
at org.flowable.engine.common.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:56)
at org.flowable.engine.common.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:51)
at org.flowable.engine.impl.TaskServiceImpl.completeTaskWithForm(TaskServiceImpl.java:230)
at TestForm.main(TestForm.java:109)
Because engines typically share the same database and transaction manager etc, we provide configurator classes to make this easy. There’s a FormEngineConfigurator (flowable-form-engine-configurator module) and SpringFormEngineConfigurator (flowable-form-spring-configurator module) class that do this. So you can do the following:
Hi Tijs,
I tried doing this way , but got error message:
The method addConfigurator(FormEngineConfigurator) is undefined for the type ProcessEngineConfiguration
I am trying to instantiate flowable engine as follows : FormEngine formEngine = formEngineConfiguration.buildFormEngine();
and on execution , its giving following error which i am not able to understand or resolve :
INFO 3/11/17 10:38 AM: liquibase: Successfully acquired change log lock
INFO 3/11/17 10:38 AM: liquibase: Successfully released change log lock
Exception in thread “main” org.flowable.engine.common.api.FlowableException: Error initialising form data schema
at org.flowable.form.engine.FormEngineConfiguration.initDbSchema(FormEngineConfiguration.java:305)
at org.flowable.form.engine.FormEngineConfiguration.init(FormEngineConfiguration.java:191)
at org.flowable.form.engine.FormEngineConfiguration.buildFormEngine(FormEngineConfiguration.java:174)
at FormTesting.main(FormTesting.java:53)
Caused by: liquibase.exception.ChangeLogParseException: Error Reading Migration File: Found 2 files that match org/flowable/form/db/liquibase/flowable-form-db-changelog.xml
at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:112)
at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:17)
at liquibase.Liquibase.getDatabaseChangeLog(Liquibase.java:229)
at liquibase.Liquibase.update(Liquibase.java:202)
at liquibase.Liquibase.update(Liquibase.java:192)
at liquibase.Liquibase.update(Liquibase.java:188)
at liquibase.Liquibase.update(Liquibase.java:181)
at org.flowable.form.engine.FormEngineConfiguration.initDbSchema(FormEngineConfiguration.java:299)
… 3 more
Caused by: java.io.IOException: Found 2 files that match org/flowable/form/db/liquibase/flowable-form-db-changelog.xml
at liquibase.util.StreamUtil.singleInputStream(StreamUtil.java:205)
at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:93)
… 10 more
Hi Tijs,
I tried casting this way :
((ProcessEngineConfigurationImpl) processEngineConfiguration).addConfigurator(new FormEngineConfigurator());
Still throwing same error :
INFO 3/11/17 10:38 AM: liquibase: Successfully acquired change log lock
INFO 3/11/17 10:38 AM: liquibase: Successfully released change log lock
Exception in thread “main” org.flowable.engine.common.api.FlowableException: Error initialising form data schema
at org.flowable.form.engine.FormEngineConfiguration.initDbSchema(FormEngineConfiguration.java:305)
at org.flowable.form.engine.FormEngineConfiguration.init(FormEngineConfiguration.java:191)
at org.flowable.form.engine.FormEngineConfiguration.buildFormEngine(FormEngineConfiguration.java:174)
at FormTesting.main(FormTesting.java:53)
Caused by: liquibase.exception.ChangeLogParseException: Error Reading Migration File: Found 2 files that match org/flowable/form/db/liquibase/flowable-form-db-changelog.xml
at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:112)
at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:17)
at liquibase.Liquibase.getDatabaseChangeLog(Liquibase.java:229)
at liquibase.Liquibase.update(Liquibase.java:202)
at liquibase.Liquibase.update(Liquibase.java:192)
at liquibase.Liquibase.update(Liquibase.java:188)
at liquibase.Liquibase.update(Liquibase.java:181)
at org.flowable.form.engine.FormEngineConfiguration.initDbSchema(FormEngineConfiguration.java:299)
… 3 more
Caused by: java.io.IOException: Found 2 files that match org/flowable/form/db/liquibase/flowable-form-db-changelog.xml
at liquibase.util.StreamUtil.singleInputStream(StreamUtil.java:205)
at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:93)
… 10 more
You have multiple org/flowable/form/db/liquibase/flowable-form-db-changelog.xml files on the classpath the error says. Maybe you can share your project, so I can try to reproduce.