Flowable-ui-app.properties file not working

#1

Hi

I have created flowable-ui-app.properties file in the lib folder of Tomcat with properties
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/flowable_test?characterEncoding=UTF-8
spring.datasource.username=root
spring.datasource.password=root

and have put the mysql connector jar too.

but it is till pointing to h2 don knw why?
I have deployed admin and idm war to tomcat webapps folder.

Thanks in advance

1 Like
Priority of application.properties and flowable-ui-app.properties
Flowable-rest db not changing to Mysql
#2

Your file is being picked up. However, it has a different order and the application.properties one is overriding your own configuration. So if you just rename the flowable-ui.app.properties to application.properties it would work like before (this would also be the way of doing it in the future). See also issue #961

More advanced way of working with Spring Boot

This part is about a more advanced way of achieving this with Spring Boot.

By default Spring would pick up files (named application.properties) from:

  1. file:./config/
  2. file:./
  3. classpath:/config/
  4. classpath:/

The last 2 are not relevant as they are on the classpath. However, the first 2 are the locations which are. With . means the folder from which you are starting the tomcat. Not sure how you are doing this. In any case you can set the spring.config.additional-location property as a environment property or a system property to a value of your own choosing.

In order to do that you would need to change your setenv.sh from the tomcat bin folder (or add one if it does not exist) and add:

CATALINA_OPTS+=" -Dspring.config.additional-location=file:~/flowable-config/"

You would then need to place your configuration properties in the flowable-config directory. The property file should then be named application.properties. Spring Boot will pick app all files that are ending on .properties or .yml.

Note: In case you decide to change spring.config.name then the defaults set in the application.properties in the application will not work and you will have to apply them.

Have a look at how to configure Application Property Files from the Spring Boot documentation.

Last info the flowable-ui-app.properties is deprecated and you should be using the Spring Boot externalized way of configuring the applications.

2 Likes
#3

@sharmavishal I’ve edited my answer. Please look at it again. It is much simpler than I initially thought :slight_smile:

#4

Just tested this but it was still using H2.
Should I keep the file in the lib folder? or place it somewhere else?

#5

@filiphr Thanks a lot it solved my problem I have one more question regarding how to use my spring boot project with flowable admin . Issue is like i have created a spring project in it i have my flowable.cfg.xml which read the datasource from applicationContext.xml and contains the spring.ProcessEngineConfigration. My project contains
process definition which has a start event as a timer event i want to deploy this process and want to use flowable admin to monitor it how can we do this. Please help.

#6

I putted it in lib folder of tomcat

#7

Any idea why it’s not working for me?
created application.properties inside tomcat\lib folder with the following content:

db=mysql
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/flowable_db?characterEncoding=UTF-8
spring.datasource.username=root
spring.datasource.password=

when starting tomcat I can see

2018-04-05 16:42:27.553  INFO 6588 --- [           main] o.s.c.a.ConfigurationClassParser         : Properties location [classpath:/META-INF/flowable-ui-app/flowable-ui-app.properties] not resolvable: class path resource [META-INF/flowable-ui-app/flowable-ui-app.properties] cannot be opened because it does not exist
2018-04-05 16:42:27.555  INFO 6588 --- [           main] o.s.c.a.ConfigurationClassParser         : Properties location [classpath:flowable-ui-app.properties] not resolvable: class path resource [flowable-ui-app.properties] cannot be opened because it does not exist
2018-04-05 16:42:27.558  INFO 6588 --- [           main] o.s.c.a.ConfigurationClassParser         : Properties location [file:flowable-ui-app.properties] not resolvable: flowable-ui-app.properties (The system cannot find the file specified)

2018-04-05 16:42:39.313 INFO 6588 — [ main] o.f.a.c.DatabaseConfiguration : database product name: ‘H2’
2018-04-05 16:42:39.313 INFO 6588 — [ main] o.f.a.c.DatabaseConfiguration : using database type: h2

Any more ideas?

Thanks,

#8

@Tarekajaj can you share what the /actuator/env endpoint is displaying for each of the apps? Please check the file before sending it to us in case it contains some sensitive information.

#9

Please find the content for the admin app in the following link,
(I was not able to attach it directly here :frowning: )

#10

The admin does use the mysql database. See:

“spring.datasource.url”: {
“value”: “jdbc:mysql://127.0.0.1:3306/flowable_db?characterEncoding=UTF-8”,
“origin”: “class path resource [application.properties]:50:23”
},
“spring.datasource.username”: {
“value”: “root”,
“origin”: “class path resource [application.properties]:51:28”
},

In your properties. Please check those properties in the flowable-modeler application as well as the log output you posted is coming from that one. Although if you run them in the same Tomcat I doubt that it would be different. The best way to check which properties you are running would be to check that endpoint. Or /actuator/configprops and search for the datasource properties.

Have a look at the Actuator WEB API and the Production-ready features of Spring Boot to see what you have there.

#11

actually, this is because I commented the datasource configuration in \flowable-admin\WEB-INF\classes\application.properties for it to work,
let me revert all the changes and try again.

#12

Uncommented the h2 datasource inside \flowable-admin\WEB-INF\classes\application.properties
and I have the mysql configuration in tomcat\lib\application.properties
this is the result of /actuator/env


It’s back to using the h2 database.

#13

It seems an issue with the way things are loaded.

Try and put your application.properties in lib/config/ folder instead. That would have precedence on our default application properties and it should work (I think :smile:)

1 Like
#14

Moved the file to /config/application.properties
and BAM!! :fireworks: it worked like a charm.

@filiphr Many Thanks for your support.
Have a nice day :slight_smile:

#15

Great. I think that’s what we would need to suggest from now on or find some other alternative for us to provide default properties :slight_smile:

1 Like
#16

Can you please ping me the entire path of lib folder? (ubuntu os)

#17

i am on ubuntu, for me its not working. i tried all the suggestions given here (copied application.properties file to usr/share/tomcat/lib/ as well as var/lib/tomcat8/lib/config).
any suggestions please.

#18

Hi there.
I’m just trying out 6.4.1.
I was able to use mariadb in 6.2.1 and practically copying my seytup on that server to the new one.
I renamed the flowable-ui-app.properties to application.properties and dropped it into tomcat/lib then configured the db properties as such:

db=mysql
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.datasource.url=jdbc:mariadb://127.0.0.1:3306/flowable?characterEncoding=UTF-8
spring.datasource.username=flowable
spring.datasource.password=kermit

However I am getting the following error:
Error creating bean with name ‘idmEngine’: FactoryBean threw exception on object creation; nested exception is org.flowable.common.engine.api.FlowableException: couldn’t deduct database type from database product name 'MariaDB’

Has the support for mariadb been dropped?

#19

Nothing was done in the code but it appears that MariaDB changed the behavior of the
getDatabaseProductName().

[[CONJ-654](https://jira.mariadb.org/browse/CONJ-654)] change metadata behaviour: DatabaseMetaData.getDatabaseProductName() nows return "MariaDB"/"MySQL" according to server. This can cause some incompatibilities with some libraries and products that do not yet know Database Type "MariaDB"

It appears that previously it was returning ‘MySQL’ and the table lookup worked.

Based on your message it is now returning ‘MariaDB’ that value is not in the lookup table (see lines 298 -327 of that same file linked above).

You can test it out yourself if you wanted to by adding another setProperty() that mapped “MariaDB” to the DATABASE_TYPE_MYSQL; recompile, jar, and deploy.

#20

I actually saw that in a changelog a while back (don’t remember when) but had forgotten.
For those of you who run into this issue simply specify the useMysqlMetadata property in the datasource url as mentioned in that JIRA (spring.datasource.url=jdbc:mariadb://127.0.0.1:3306/flowable?useMysqlMetadata=true&characterEncoding=UTF-8) and that resolves the issue.
thank you @dbmalkovsky