FormEngines.getDefaultFormEngine() returns NULL

Hi,

I want to use the form engine. However, the following call is returning null. FormEngine formEngine = (FormEngine) FormEngines.getDefaultFormEngine();
I created a configuration file named flowable.form.cfg.xml as explained in the documentation. I don’t know what I’m doing wrong. I did the same to get the default process engine and everything worked as expected.

Thanks,
Clara

I attach the ERROR details:

11:02:28,205 [main] ERROR org.flowable.form.engine.FormEngines  - Exception while initializing form engine: liquibase/database/DatabaseConnection
java.lang.NoClassDefFoundError: liquibase/database/DatabaseConnection
	at org.flowable.form.engine.FormEngines.buildFormEngine(FormEngines.java:163)
	at org.flowable.form.engine.FormEngines.initFormEngineFromResource(FormEngines.java:144)
	at org.flowable.form.engine.FormEngines.init(FormEngines.java:76)
	at org.flowable.form.engine.FormEngines.getFormEngine(FormEngines.java:198)
	at org.flowable.form.engine.FormEngines.getDefaultFormEngine(FormEngines.java:187)
	at org.flowable.CallForForecasts.main(CallForForecasts.java:17)
Caused by: java.lang.ClassNotFoundException: liquibase.database.DatabaseConnection
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	... 6 more

Previously I had another error:

11:08:01,036 [main] ERROR org.flowable.form.engine.FormEngines - Exception while initializing form engine: org/apache/commons/io/IOUtils
java.lang.NoClassDefFoundError: org/apache/commons/io/IOUtils

I solved it adding this dependency:

<dependency> 
	<groupId>org.apache.commons</groupId>
	<artifactId>commons-io</artifactId> 
	<version>1.3.2</version> 
</dependency> 

Any idea of what could be wrong?

Hi Clara,

Did you include the flowable-form-engine as dependency in your project?

Best regards,

Tijs

Thanks @tijs, the dependency solved the error. However, now I had another one:

11:15:54,120 [main] ERROR org.flowable.form.engine.FormEngines  - Exception while initializing form engine: Error initialising form data schema
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 org.flowable.form.engine.FormEngines.buildFormEngine(FormEngines.java:164)
	at org.flowable.form.engine.FormEngines.initFormEngineFromResource(FormEngines.java:144)
	at org.flowable.form.engine.FormEngines.init(FormEngines.java:76)
	at org.flowable.form.engine.FormEngines.getFormEngine(FormEngines.java:198)
	at org.flowable.form.engine.FormEngines.getDefaultFormEngine(FormEngines.java:187)
	at org.flowable.CallForForecasts.main(CallForForecasts.java:17)
Caused by: liquibase.exception.ChangeLogParseException: Error Reading Migration File: Found 3 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)
	... 8 more
Caused by: java.io.IOException: Found 3 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)
	... 15 more

I read in a post a similar situation but I don’t know it was finally solved. I checked the flowable-form-db-changelog.xml and in effect, there are 3 files with this name (I’m working with version 6.2.0).

Hi Clara,

Having this file 3 times on the classpath should not be possible when the dependencies are set correctly.
Could you share the dependencies of your project? Are you using Maven?

Best regards,

Tijs

Yes, I’m using Maven. I think that the files repetition is related to a problem that I had when I cloned the project. I’m working to solve this. In my project the only dependencies that I have are the following:

<dependency>
	<groupId>org.flowable</groupId>
	<artifactId>flowable-engine</artifactId>
	<version>6.2.0</version>
</dependency>
<dependency>
	<groupId>org.flowable</groupId>
	<artifactId>flowable-form-engine</artifactId>
	<version>6.2.0</version>
</dependency>

<dependency>
	<groupId>org.postgresql</groupId>
	<artifactId>postgresql</artifactId>
	<version>42.1.4</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>

Thanks for the quick responses.

That looks fine. Were you able to resolve the issue with the 3 liquibase changelog files?

Best regards,

Tijs

I didn’t resolve it yet. I thought that I made something wrong when I build Flowable engine in Eclipse so I build it again but the error is the same (Error Reading Migration File).
I’m working to solve it, when I had any news I will update the post.

Thanks,
Clara

Hi,
I solved the error. The problem was that I imported JARs that were already available in the Maven Dependencies, so I just needed to remove these JARs.

Regards,
Clara

Hi @clara.gaset
what were those JAR’s that we have to remove?