Custom assignment via camunda:candidateUsers/camunda:assignee using Spring Bean

855 views
Skip to first unread message

Melissa Palmer

unread,
Sep 17, 2014, 9:53:15 AM9/17/14
to camunda-...@googlegroups.com
Hi

I'm looking at all the alternatives for assigning a task to a user/group that Camunda has on offer to workout what would be best for us to use. 

I'm wanting to use what's described at: http://docs.camunda.org/latest/api-references/bpmn20/#tasks-user-task in relation to Spring Beans. Documentation has the following information: 
"When using Spring or CDI it is possible to use the custom assignment attributes as described in the section above and delegate to a bean using a task listener with an expression that listens to task create events. In the following example, the assignee will be set by calling the findManagerOfEmployee on the ldapService Spring/CDI bean. The emp parameter that is passed is a process variable>."

Where you can then use: 
<userTask id="task" name="My Task" camunda:assignee="${ldapService.findManagerForEmployee(emp)}"/>
or
<userTask id="task" name="My Task" camunda:candidateUsers="${ldapService.findAllSales()}"/>

I have created the FakeLdapService class as in the docs and configured a bean within the Spring applicationContext.xml file as follows: 
 <bean id="ldapService" class="co.za.itdynamics.assignment.FakeLdapService" />


However am always getting errors and cannot get this working
1) For the "camunda:assignee="${ldapService.findManagerForEmployee(emp)}"" option on server startup (if using the Started implementation of InitialisingBean runtimeService.startProcessInstanceByKey("customassignment"); ) I get the following error:
SEVERE: Error while closing command context
org
.camunda.bpm.engine.ProcessEngineException: Error while evaluating expression: ${ldapService.findManagerForEmpl
oyee
(emp)}. Cause: Could not lookup beanmanager in jndi. If no jndi is available, set the beanmanger to the 'local
Instance'
property of this class.
        at org
.camunda.bpm.engine.impl.el.JuelExpression.getValue(JuelExpression.java:61)
        at org
.camunda.bpm.engine.impl.bpmn.behavior.UserTaskActivityBehavior.handleAssignments(UserTaskActivityBe
havior
.java:114)
        at org
.camunda.bpm.engine.impl.bpmn.behavior.UserTaskActivityBehavior.execute(UserTaskActivityBehavior.jav
a
:97)...
.....
....
...
...
...


2) For the "camunda:candidateUsers="${ldapService.findAllSales()}"/>" option. Server starts up correctly... however at run time when I try to move a process to the task with this configuration I get the following error: 
Server Error: Cannot submit task form 531a76a3-3e70-11e4-90f1-d4bed948baf9: Unknown property used in expression: ${ldapService.findAllSales()}. Cause: Cannot resolve identifier 'ldapService'


Is there any steps that I have missed here?

Thanks
Melissa

Melissa Palmer

unread,
Sep 17, 2014, 2:55:53 PM9/17/14
to camunda-...@googlegroups.com
UPDATE: there seems to be a problem with my deployment, as using the same wars within the "camunda-bpm-tomcat-7.1.0-Final" webapps all works 100% 

Problem sees to be with the setup/config of "Install the platform on a vanilla Tomcat" using this setup it seems that none of my Java classes from a process war can be see on when initiating a process on this server config setup. 

I getting errors such as:
Server Error: Cannot instantiate process definition myassignmenthandler:4:76296a0b-3e87-11e4-9ae7-d4bed948baf9: couldn't instantiate class org.camunda.bpm.TestClass

Class is in the webapp under "\WEB-INF\classes" and using the very same war on the "camunda-bpm-tomcat-7.1.0-Final" server works correctly. 

Thanks
Melissa

Christian Lipphardt

unread,
Sep 17, 2014, 3:21:37 PM9/17/14
to camunda-...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "camunda BPM users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camunda-bpm-us...@googlegroups.com.
To post to this group, send email to camunda-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/camunda-bpm-users/7e0dde70-229b-4ef7-b0c9-4a23127992f7%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Melissa Palmer

unread,
Sep 17, 2014, 4:06:18 PM9/17/14
to camunda-...@googlegroups.com
I have just managed to solve the problem of "Cannot instantiate process definition"... I was using tomcat: 7.0.27... I now switched to 7.0.55 and managed to get everything working. 

I am still getting the initial issue: I cannot use Spring Bean for assignments: eg:  camunda:assignee="${ldapService.findManagerForEmployee(emp)}"

I am seeing the following error::
Server Error: Cannot instantiate process definition customassignment:1:ac2fb8cc-3ea2-11e4-949f-d4bed948baf9: Error while evaluating expression: ${ldapService.findManagerForEmployee(emp)}. Cause: Could not lookup beanmanager in jndi. If no jndi is available, set the beanmanger to the 'localInstance' property of this class.

@Christian thank you.. yes I do have that config setup correctly. 

Melissa

Christian Lipphardt

unread,
Sep 17, 2014, 4:12:33 PM9/17/14
to camunda-...@googlegroups.com
Hi Melissa,

You need to package the camunda-engine-cdi maven dependency [1] with compile scope inside your maven project.
Besides, if you want to use CDI on Tomcat, you need to install an CDI implementation like Weld in Tomcat.
A good installation guide seems to be [2].


Cheers,
Christian



Reply all
Reply to author
Forward
0 new messages