0

enter image description here

I am trying to use a boundary timer event in BPMN XML file , to trigger the service task which will call out a custom java bean after some period defined in timer definition. Below is the implemented code:

<serviceTask id="servicetask1" name="Task2"
             flowable:async="true" flowable:class="com.leave.request.handler.SampleTask"></serviceTask>
        <boundaryEvent id="boundarytimer1" name="Timer"
            attachedToRef="tlReviewTask" cancelActivity="true">
            <timerEventDefinition>
                <timeDuration>PT30S</timeDuration>
            </timerEventDefinition>
        </boundaryEvent>
        <sequenceFlow id="flow16" sourceRef="boundarytimer1"
            targetRef="servicetask1"></sequenceFlow>

1.In the above, I have defined a timer boundary event having the duration of 30sec(PT30S). 2.Once the time duration is complete, the service task will be triggered thru the sequence flow. 3.In service task , have used the delegate expression which will call out Sampletask Bean , the custom Javadelegate class created in my SpringBoot Java Project. 4.The time event is getting triggered , but the Bean class is not called and getting the exception snip attached below.

<serviceTask id="servicetask1" name="Task2"
             flowable:async="true" flowable:class="com.leave.request.handler.SampleTask"[enter image description here](https://i.stack.imgur.com/YSsg5.png)></serviceTask>

Tried this solution:

<serviceTask id="servicetask1" name="Task2"
             flowable:async="true" flowable:delegateExpression="${sampleTask}"></serviceTask>

Used this delegateExpresssion, but still the same issue.

James Z
  • 12,209
  • 10
  • 24
  • 44
  • Whenever you use "${sampleTask}",in delegate expressions, Flowable looks for a bean defined with that name(Spring). Your ProcessEngine must be aware of this bean. Ideally in spring boot, all your spring beans are available for use by flowable. Please share your code where you have defined ${sampleTask} bean. – Saideep Ullal Dec 01 '22 at 14:29
  • Hey Saideep ,Have shared the code in Question post . Thank you. – BHARAT RATHOD Dec 02 '22 at 06:04

1 Answers1

0

The screenshot of the exception shows that Flowable uses reflection (it isnot looking up a spring bean name used in an expression). It is trying to find an instantiate the class "com.leave.request.handler.SampleTask", but cannot fin it in the class path. Please double check if

  • the class name and package are spelled correctly and the class is in the correct package folder
  • the folder is part of the src folders and gets compiled
  • the class compiles successfully before startup and is included in the runtime
  • a default constructor is available and accessible
rob2universe
  • 7,059
  • 39
  • 54