Camunda User Task execution fails

1.2k views Asked by At

I have a BPMN model embedded in an Camunda Spring application. The setup I took from this site: https://github.com/camunda/camunda-bpm-examples/tree/master/deployment/embedded-spring-rest

I am trying to get a bmpn user task connected to my application and execute it when I run the whole process. Besides, I want a form to be opened when executing this task. Unfortunately, I get an error message when trying to do this. I made following configurations:

In the user task of the .bpmn file I added this line:

<userTask id="Task_18modqk" name="fill out form" camunda:formKey="embedded:app:forms/request-loan.html" camunda:assignee="${fillOut}">

My bpmn looks like this: enter image description here

Then, in the application context, I have created a bean like this:

<bean id="fillOut" class="org.camunda.bpm.example.loanapproval.FillOutForm" />

Also, I have created a class related to the bean with the following code: package org.camunda.bpm.example.loanapproval;

public class FillOutForm 
{
    public String fillOut() {
    return "form filled out";
 }

}

When I run the starter class, I get following error:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.camunda.bpm.example.loanapproval.Starter#0'

defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.ClassCastException: org.camunda.bpm.example.loanapproval.FillOutForm cannot be cast to java.lang.String

Service Tasks work quiet well because the corresponding classes implement the JavaDelegate but I dont know how to work with User tasks in combination with Spring beans.

Please provide me some help Thanks in advance

1

There are 1 answers

1
miwoe On

It seems to work, you set ${fillOut} which maps to the related Spring bean (<.bean id="fillOut"....), but Camunda Assignee property expects a String not an object...

If you type ${fillout.fillout()} it should work.

(btw. it looks a bit strange what you are doing ;), but I am also not a Camunda expert... )