cancel
Showing results for 
Search instead for 
Did you mean: 

org.jbpm.graph.def.DelegationException: A valid SecureCon...

bedag-moo
Champ in-the-making
Champ in-the-making
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 …
5 REPLIES 5

vedran
Champ in-the-making
Champ in-the-making
Hi,

I'm facing a similar problem. A timer fires and moves to the decision node, which is then supposed to start an action. I get the following exception:

16:38:24,041  ERROR [graph.def.GraphElement] action threw exception: A valid SecureContext was not provided in the RequestContext
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.audit(AuditComponentImpl.java:241)
        at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
        at $Proxy49.personExists(Unknown Source)
        at org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript.execute(AlfrescoJavaScript.java:136)
        at org.jbpm.graph.def.Action.execute(Action.java:122)
        at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:259)
        at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:215)
        at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:185)
        at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:169)
        at org.jbpm.graph.def.Node.enter(Node.java:302)
        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:597)
        at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:147)
        at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$adfdf448.enter(<generated>)
        at org.jbpm.graph.def.Transition.take(Transition.java:151)
        at org.jbpm.graph.def.Node.leave(Node.java:393)
        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:597)
        at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:147)
        at org.jbpm.graph.node.State$$EnhancerByCGLIB$$f70fd822.leave(<generated>)
        at org.jbpm.graph.exe.Token.signal(Token.java:192)
        at org.jbpm.graph.exe.Token.signal(Token.java:155)
        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:597)
        at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:147)
        at org.jbpm.graph.exe.Token$$EnhancerByCGLIB$$5a8c9adc.signal(<generated>)
        at org.jbpm.job.Timer.execute(Timer.java:93)
        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:597)
        at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:147)
        at org.jbpm.job.Job$$EnhancerByCGLIB$$427b1a2b.execute(<generated>)
        at org.jbpm.job.executor.JobExecutorThread.executeJob(JobExecutorThread.java:173)
        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:236)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:166)
        at org.alfresco.repo.workflow.jbpm.AlfrescoJobExecutorThread.executeJob(AlfrescoJobExecutorThread.java:57)
        at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:64)
2008.07.16 16:40:04 org.apache.coyote.http11.Http11BaseProtocol pause

This does not happen when the timer node is ommitted and the previous node leaves directly to the decision node. Below is the process definition:


   <state name="timerState">
      <timer duedate="1 minute" transition="fire"/>
      <transition name="fire" to="checkTime"></transition>
   </state>
   <decision name="checkTime">
      <event type="node-enter">
      <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
         <runas>admin</runas>
         <script>
               <expression>
                  var act = actions.create("TimerActionBean");
                  for (var i = 0; i &lt; bpm_package.children.length; i++) {
                     act.execute(bpm_package.children[i]);
                  }
                  testwf_ret_val = act.parameters["timer_due"];
               </expression>
               <variable name="testwf_ret_val" access="read,write" />
               <variable name="bpm_package" access="read" />
         </script>
      </action>
      </event>
      <transition to="nextWorkflowNode" name="timerFired">
         <condition>#{testwf_ret_val == "true"} </condition>
      </transition>
      <transition to="timerState" name="to timerState">
         <condition>#{testwf_ret_val == "false"} </condition>
      </transition>
   </decision>

If this post is unanswered because it's a duplicate, I would very much appreciate to be pointed to the correct thread as I have not been able to find it myself.

Thx in advance,
     Vedran

vedran
Champ in-the-making
Champ in-the-making
To follow up on this question. If after a period of wait time by a timer login credentials are lost, isn't it enough to specify

<runas>some_user</runas>

in the action tag, for alfresco to run the action as "some_user"?

Again, any help on this issue would be appreciated.

@edit: typo

vedran
Champ in-the-making
Champ in-the-making
I managed to solve this through AuthenticationUtils by extending the AlfrescoJavaScript and overriding the execute method. The problem is that the credentials are lost while waiting for the timer to fire, and runas can not set the current user to admin since it first has to check if the runas person exists. In order to do that, credentials need to exist so that a call to PersonService.personExists(String) succeeds.

aswini
Champ in-the-making
Champ in-the-making
So how did you solve this on your processdefinition xml?

susana
Champ in-the-making
Champ in-the-making
I have exactly the same problem. I tryed with authenticationUtils but the error still appears. How did you solved it? Thanks