Internal Server Error when using custom flowable-rest module

I have an application which has flowable-idm-service, flowable-ui-task and flowable-ui-modeler modules and I have imported flowable-rest module and build it in my current workspace.

I haven’t made any other changes apart from that.

So, I tried to start my process instance by making a POST call to endpoint localhost:9999/flowable-task/process-api/runtime/process-instaances with suitable processDefinitionKey.
I got the below exception:

{
    "timestamp": "2019-09-05T10:17:07.943+0000",
    "status": 500,
    "error": "Internal Server Error",
    "message": "Error creating bean with name 'formDataResource': Unsatisfied dependency expressed through field 'restResponseFactory'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.flowable.rest.service.api.RestResponseFactory' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}",
    "trace": "org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'formDataResource': Unsatisfied dependency expressed through field 'restResponseFactory'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.flowable.rest.service.api.RestResponseFactory' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}\r\n\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596)\r\n\tat org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90)\r\n\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374)\r\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1411)\r\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592)\r\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)\r\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)\r\n\tat org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$133/433097229.getObject(Unknown Source)\r\n\tat org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)\r\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)\r\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)\r\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:845)\r\n\tat org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877)\r\n\tat org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)\r\n\tat org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:701)\r\n\tat org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:577)\r\n\tat org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:529)\r\n\tat org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:169)\r\n\tat javax.servlet.GenericServlet.init(GenericServlet.java:158)\r\n\tat org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1122)\r\n\tat org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:777)\r\n\tat org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)\r\n\tat org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)\r\n\tat org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)\r\n\tat org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)\r\n\tat org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)\r\n\tat org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)\r\n\tat org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)\r\n\tat org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)\r\n\tat org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)\r\n\tat org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:853)\r\n\tat org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587)\r\n\tat org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)\r\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\r\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\r\n\tat org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)\r\n\tat java.lang.Thread.run(Thread.java:745)\r\nCaused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.flowable.rest.service.api.RestResponseFactory' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}\r\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1658)\r\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1217)\r\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1171)\r\n\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593)\r\n\t... 36 more\r\n",
    "path": "/flowable-task/process-api/runtime/process-instances"
}

However, the endpoint was working fine before the import of flowable-rest module.
Reason for this import:
If the import works fine I can add some endpoints from my side like /process-api/some-new-endpoint, which I can access in future.

I can see in FormDataResource.java of package org.flowable.rest.service.api.form, there is a member variable of restResponseFactory probably the point of error is that only.

Need to dig more on it.

@akki

I’m having trouble following what you are trying to do. Flowable-Task already has the rest API embedded. Implementing a custom end point does not require a custom implementation of flowable-rest you can simply add @RestController annotated beans and create an auto configured jar. Example Auto-configured library and Docs on custom bean deployment

Sorry for the confusion, yes we can add endpoints using @RestController, but I was having hard time calling such endpoints from outside flowable, like from POSTMAN, the REST endpoint which you gave me in this post, I’m able to use it to make calls from outside flowable.

That’s why I thought to just try to add a custom endpoint in ProcessInstanceCollectionResource.java and seeing if I’ll be able to call my endpoint from outside flowable or not.

Hope I made some things clear!!

Anyways I got it working, looks like if I include flowable-rest module it’ll throw error but if I don’t include it in workspace and make changes in flowable-rest module, build it, get new jar in local maven repository, I don’t get any issues to use it.