ERROR: no schema has been selected to create in

Hiii All,

Following this Spring Boot · Flowable Open Source Documentation I’ve created an app with dependency flowable-spring-boot-starter (6.4.1) & postgresql db. I’ve deployed it in cloud foundry as well and it worked fine. But somehow now the same application is not getting deployed and I’m getting below error trace, could you please tell me the issue and how to fix it?

2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘TCMController’: Unsatisfied dependency expressed through field ‘tcmImportService’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘TCMImportService’: Unsatisfied dependency expressed through field ‘runtimeService’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘runtimeServiceBean’ defined in class path resource [org/flowable/spring/boot/ProcessEngineServicesAutoConfiguration.class]: Unsatisfied dependency expressed through method ‘runtimeServiceBean’ parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘processEngine’ defined in class path resource [org/flowable/spring/boot/ProcessEngineServicesAutoConfiguration$AlreadyInitializedAppEngineConfiguration.class]: Unsatisfied dependency expressed through method ‘processEngine’ parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘flowableAppEngine’: FactoryBean threw exception on object creation; nested exception is org.flowable.common.engine.api.FlowableException: couldn’t create db schema: create table ACT_GE_PROPERTY (
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT NAME_ varchar(64),
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT VALUE_ varchar(300),
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT REV_ integer,
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT primary key (NAME_)
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT )
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:643) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:130) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1422) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:882) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at c.s.c.l.s.c.cas.Application.main(Application.java:11) [classes/:na]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_265]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_265]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_265]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_265]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [app/:na]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [app/:na]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) [app/:na]
2020-10-05T00:38:30.33+0530 [APP/PROC/WEB/0] OUT at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:58) [app/:na]

Regards,
Ashmita Sinha

It seems you are not running any DB migration script and offloading the application to create the flowable tables. Does your application have proper roles to create the tables etc.?

@sukalpo

I’ve done basic configuration for flowable and spring boot integration, which is,

  1. added flowable-spring-boot-starter dependency in pom.xml
  2. Created bean called Datasource for flowable to use

And yes I do have proper roles to create tables. I’ve few more tables, so I’d removed config for flowable and then deployed and it worked properly. But with flowable I’m unable to deploy with the above error trace.

Regards,
Ashmita Sinha

@aashi - Generally we offload the db creation to a liquibase script as our application wont have the appropriate db priviledges. Why dont you try that. Create the tables separately through liquibase and then start the application.

@sukalpo - I’ve noticed one more thing. If the schema is already created then flowable is able to create tables during deployment. This indicates that somehow it’s not able to get which schema to work with during deployment. Any help on this?

I’ve also added below properties in application.properties file,
flowable.database-schema=casdbschema
flowable.database-schema-update=true

Hey @aashi,

Flowable is not creating the schema for you. You have to do that on your own before you start Flowable.

Cheers,
Filip

Hi @filiphr,

Isn’t there any way to make sure schema is created and flowable is able to create tables using liquibase scripts?

What should be the idle behaviour?

Since the application will be deployed in cloud foundry, I can’t make sure every time that the schema or tables are already created.

Regards,
Ashmita Sinha

Hey @aashi,

The tables are created automatically created. If you need a custom schema then you’ll have to do it on your own. Flowable does not create the schema.

Cheers,
Filip

Hi,

I’m already creating my custom db schema but flowable is unable to pick it while deployment. And this is happening only when schema was not already created in previous deployment, otherwise it’s working fine.

If there’s no other way then I need to consider creating tables before deployment only.

Regards,
Ashmita Sinha

Hey @aashi,

If the schema is there before the deployment and it is working then it seems that your steps during the deployment are not OK. Otherwise if the schema is created before Flowable runs then it will work correctly.

How are you creating the custom db schema? Are you doing it as part of your application?

Cheers,
Filip

Hey @filiphr,

Initially, first, it checks whether the schema is created or not, if not, then the schema is created. And I could see in the logs that schema is getting created before flowable tries to create db tables. Is there any configuration through which I can specify that flowable has to start creating db tables once schema is created properly?

So far, I’m aware of the below properties which needs to be placed in application.properties file. But it doesn’t seems to be working,

flowable.database-schema=casdbschema
flowable.database-schema-update=true

Regards,
Ashmita

Hey @aashi,

We would need an example of what you are saying. What you are saying should work without problems, Flowable doesn’t check whether the schema exists or not it just uses it. When using Spring Boot it will also use the DataSource configured by Spring Boot to do all the DB connections.

Cheers,
Filip