# JavaDelegate interface

**URL:** <https://forum.flowable.org/t/javadelegate-interface/3641>\
**Category:** Uncategorized\
**Created:** [March 28, 2019, 1:06pm UTC](https://forum.flowable.org/t/javadelegate-interface/3641 "2019-03-28T13:06:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kajetan](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/kajetan/32/1096_2.png) [@kajetan](https://forum.flowable.org/u/kajetan)\
**Post date:** [March 28, 2019, 1:06pm UTC](https://forum.flowable.org/t/javadelegate-interface/3641/1 "2019-03-28T13:06:11Z")

</div>

Hi.

I am using **service task** with spring.

This is my delegate expression: #{objectLocationListener.methodX(execution)}

My delegate class is simple spring component as:

> @Slf4j  
> @Component  
> public class ObjectLocationListener{
> 
> public void methodX( DelegateExecution execution ){  
> Object o = delegate.getVariables();  
> }  
> }

This methodX is executed, but after that I get:

Caused by: org.flowable.common.engine.api.FlowableIllegalArgumentException: Delegate expression #{objectLocationListener.methodX(execution)} did neither resolve to an implementation of interface org.flowable.engine.impl.delegate.ActivityBehavior nor interface org.flowable.engine.delegate.JavaDelegate

Am i missing something here?

Just for clarification: I know for JavaDelegate interface when calling class, but I want to call Java method in my spring bean…

Best regards

Uros

---

<div class="post-metadata">

**Author:** ![martin.grofcik](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/martin.grofcik/32/71_2.png) [@martin.grofcik](https://forum.flowable.org/u/martin.grofcik)\
**Post date:** [March 29, 2019, 6:32am UTC](https://forum.flowable.org/t/javadelegate-interface/3641/2 "2019-03-29T06:32:55Z")

</div>

Hi Uros,

an example with service task and delegate expression can be found

> <https://github.com/flowable/flowable-engine/blob/73eeaafd0fae7f8af081ccc4cfb0578f77d12cb8/modules/flowable-spring/src/test/java/org/flowable/spring/test/servicetask/ServiceTaskSpringDelegationTest.java>

To find out more about your case could you add a link to jUnit test or bpmn file?

Regards  
Martin

---

<div class="post-metadata">

**Author:** ![kajetan](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/kajetan/32/1096_2.png) [@kajetan](https://forum.flowable.org/u/kajetan)\
**Post date:** [March 29, 2019, 10:44am UTC](https://forum.flowable.org/t/javadelegate-interface/3641/3 "2019-03-29T10:44:33Z")

</div>

UPDATE:

I was using delegate expression instead of expression. Thanks Martin.

It works as expected now.
