A task is assigned to a pool and declares a timer which in turn contains a JavaScript Action. When the timer fires before somebody claims ownership of the task, timer execution fails with the following exception (quoted from Alfresco's database, column jbpm_job.EXCEPTION_)org.jbpm.graph.def.DelegationException: A valid SecureContext was not provided in the RequestContext
at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:367)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:147)
at org.jbpm.graph.def.ProcessDefinition$$EnhancerByCGLIB$$7f5dbaa3.raiseException(<generated>)
at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:358)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:147)
at org.jbpm.graph.node.TaskNode$$EnhancerByCGLIB$$56eb047d.raiseException(<generated>)
at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:358)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:147)
at org.jbpm.taskmgmt.def.Task$$EnhancerByCGLIB$$c3405880.raiseException(<generated>)
at org.jbpm.job.Timer.execute(Timer.java:66)
at org.alfresco.repo.workflow.jbpm.AlfrescoTimer.execute(AlfrescoTimer.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:147)
at org.jbpm.job.Job$$EnhancerByCGLIB$$b1223416.execute(<generated>)
at org.jbpm.job.executor.JobExecutorThread.executeJob(JobExecutorThread.java:161)
at org.alfresco.repo.workflow.jbpm.AlfrescoJobExecutorThread.access$001(AlfrescoJobExecutorThread.java:38)
at org.alfresco.repo.workflow.jbpm.AlfrescoJobExecutorThread$TransactionJob.execute(AlfrescoJobExecutorThread.java:84)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:225)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:155)
at org.alfresco.repo.workflow.jbpm.AlfrescoJobExecutorThread.executeJob(AlfrescoJobExecutorThread.java:57)
at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:62)
Caused by: net.sf.acegisecurity.AuthenticationCredentialsNotFoundException: A valid SecureContext was not provided in the RequestContext
at net.sf.acegisecurity.intercept.AbstractSecurityInterceptor.credentialsNotFound(AbstractSecurityInterceptor.java:477)
at net.sf.acegisecurity.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:355)
at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:77)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.alfresco.repo.audit.AuditComponentImpl.auditImpl(Audi
The relevant part of the process definition is: <task-node name="review">
<task name="bwf:review">
<assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
<pooledactors>#{reviewGroup}</pooledactors>
</assignment>
<event type="task-create">
<script>
if (bwf_reviewDueDate != void) taskInstance.dueDate = bwf_reviewDueDate;
taskInstance.priority = bpm_workflowPriority;
</script>
</event>
<timer duedate="#{bwf_reviewDueDate == null ? never : bwf_reviewDueDate}">
<action ref-name="sleepyheadAlert"/>
</timer>
How can I execute a timer attached to a task even if the task is not assigned yet? A delay in task assignment is one of the things that timer is supposed to handle …