AnsweredAssumed Answered

org.jbpm.graph.def.DelegationException      

Question asked by ucf on Apr 16, 2014
Latest reply on Apr 17, 2014 by mitpatoliya
hello I'm getting the error bellow when trying to get the noderef of the bpm_backage and the noderef of the content in this package(the content is one document since I upload one single document in a WF instance),and  here's my code:

package com.ucf.workflow;

import java.util.Iterator;
import java.util.List;

import org.alfresco.repo.action.executer.MailActionExecuter;
import org.alfresco.repo.admin.SysAdminParams;
import org.alfresco.repo.workflow.jbpm.JBPMSpringActionHandler;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ActionService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
import org.apache.log4j.Logger;
import org.jbpm.graph.def.Transition;
import org.jbpm.graph.exe.ExecutionContext;
import org.springframework.beans.factory.BeanFactory;
import org.alfresco.service.cmr.workflow.WorkflowService;
import org.alfresco.repo.workflow.jbpm.JBPMNode;



public class ExternalReviewNotification extends JBPMSpringActionHandler {

   private static final long serialVersionUID = 1L;
   private static final String FROM_ADDRESS = "recyplac@gmail.com";
   private static final String SUBJECT = "document approval";
   private static QName PROP_EMAIL = QName.createQName(
         UcfModel.NAMESPACE_UCF_CONTENT_MODEL,
         UcfModel.PROP_UCF_EMAILUCF);
   private static Logger logger = Logger.getLogger(ExternalReviewNotification.class);
   public static final String PROP_EMAILSOUMETTEUR_STRING = "emailSoumetteur";
   private static String urlDRepo;
   private static String urlDShare;
   private static String userName;
   private static String address = "youssef.elhaddioui@gmail.com";
   protected ActionService actionService;
   private SysAdminParams sysAdminParams;
   private WorkflowService workflowService;
   

   public ExternalReviewNotification() {

   }

   @Override
   protected void initialiseHandler(BeanFactory beanfactory) {

      actionService = (ActionService) beanfactory.getBean("actionService");

   }


   
   @Override
   public void execute(ExecutionContext executionContext) throws Exception {
      logger.debug("Inside ExternalReviewNotification.execute()");
      String recipient = "youssef.elhaddioui@gmail.com";
       NodeRef nodeRef =  ((JBPMNode) executionContext.getContextInstance().getVariable("bpm_package")).getNodeRef();
          NodeRef nf=workflowService.getPackageContents(nodeRef).get(0);
         StringBuffer sb = new StringBuffer();
         sb.append("the uploaded doc is in \n");
         sb.append("127.0.0.1:8090/share/proxy/alfresco/api/node/content/workspace/SpacesStore/");
      
         sb.append(nf);
         sb.append("\n");
      
      sb.append("You have been assigned to a task named ");
      sb.append(executionContext.getToken().getNode().getName());
      sb.append(". See the appropriate action by clicking one of the links below:\r\n\r\n");
      List<Transition> transitionList = executionContext.getNode().getLeavingTransitions();
      for (Iterator<Transition> it = transitionList.iterator(); it.hasNext();) {
         Transition transition = it.next();
         sb.append(transition.getName());
         sb.append("\r\n");

         // TODO Adapt thie webscript so it takes the task id
         sb.append("http://localhost:8089/alfresco/service/workflows?nodeRef=jbpm$");
         sb.append(executionContext.getProcessInstance().getId());
         sb.append("-@");
         sb.append("&action=A");
         // sb.append(transition.getName());
         sb.append("&guest=true");
         sb.append("\r\n\r\n");
      }
      sb.append(" Or edit The task by here : ");
      sb.append("\r\n");
      sb.append("http://127.0.0.1:8090/share/page/task-edit?taskId=jbpm$");
      sb.append(executionContext.getTaskInstance().getId());

      logger.debug("Message body:" + sb.toString());

      Action mailAction = this.actionService.createAction(MailActionExecuter.NAME);
      mailAction.setParameterValue(MailActionExecuter.PARAM_SUBJECT, ExternalReviewNotification.SUBJECT);
      mailAction.setParameterValue(MailActionExecuter.PARAM_TO, recipient);
      mailAction.setParameterValue(MailActionExecuter.PARAM_FROM, ExternalReviewNotification.FROM_ADDRESS);
      mailAction.setParameterValue(MailActionExecuter.PARAM_TEXT, sb.toString());

      this.actionService.executeAction(mailAction, null);

      logger.debug("Mail action executed");

      return;
   }

   public WorkflowService getWorkflowService() {
      return workflowService;
   }

   public void setWorkflowService(WorkflowService workflowService) {
      this.workflowService = workflowService;
   }
public ActionService getActionService() {
      return actionService;
   }

   public void setActionService(ActionService actionService) {
      this.actionService = actionService;
   }

   public SysAdminParams getSysAdminParams() {
      return sysAdminParams;
   }

   public void setSysAdminParams(SysAdminParams sysAdminParams) {
      this.sysAdminParams = sysAdminParams;
   }


   
}
the exception:
org.alfresco.service.cmr.workflow.WorkflowException: 03160034 Failed to signal transition null from workflow task jbpm$355.
   at org.alfresco.repo.workflow.jbpm.JBPMEngine.endTask(JBPMEngine.java:2556)
   at org.alfresco.repo.workflow.WorkflowServiceImpl.endTask(WorkflowServiceImpl.java:1005)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
   at org.alfresco.service.cmr.workflow.WorkflowPermissionInterceptor.invoke(WorkflowPermissionInterceptor.java:54)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:46)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:161)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at com.sun.proxy.$Proxy67.endTask(Unknown Source)
   at com.lafarge.document.UploadLafargeDocument.startWorkflow(UploadLafargeDocument.java:168)
   at com.lafarge.document.UploadLafargeDocument.execute(UploadLafargeDocument.java:118)
   at org.alfresco.repo.web.scripts.RepositoryContainer$3.execute(RepositoryContainer.java:429)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:452)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:491)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:529)
   at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:341)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:378)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
   at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:132)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:61)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
   at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
   at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
   at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
   at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
   at java.lang.Thread.run(Thread.java:744)
Caused by: org.jbpm.graph.def.DelegationException
   at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:388)
   at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:379)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
   at org.jbpm.graph.node.TaskNode$$EnhancerByCGLIB$$39158e0f.raiseException(<generated>)
   at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:379)
   at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:301)
   at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:241)
   at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:213)
   at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:196)
   at org.jbpm.taskmgmt.exe.TaskInstance.create(TaskInstance.java:170)
   at org.alfresco.repo.workflow.jbpm.WorkflowTaskInstance.create(WorkflowTaskInstance.java:106)
   at org.jbpm.taskmgmt.exe.TaskMgmtInstance.createTaskInstance(TaskMgmtInstance.java:218)
   at org.jbpm.graph.node.TaskNode.execute(TaskNode.java:174)
   at org.jbpm.graph.def.Node.enter(Node.java:390)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
   at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$abbc87d1.enter(<generated>)
   at org.jbpm.graph.def.Transition.take(Transition.java:167)
   at org.jbpm.graph.def.Node.leave(Node.java:479)
   at org.jbpm.graph.node.StartState.leave(StartState.java:82)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
   at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$abbc87d1.leave(<generated>)
   at org.jbpm.graph.exe.Token.signal(Token.java:223)
   at org.jbpm.graph.exe.Token.signal(Token.java:150)
   at org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:490)
   at org.alfresco.repo.workflow.jbpm.WorkflowTaskInstance.end(WorkflowTaskInstance.java:135)
   at org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:406)
   at org.alfresco.repo.workflow.jbpm.JBPMEngine$30.doInJbpm(JBPMEngine.java:2529)
   at org.springmodules.workflow.jbpm31.JbpmTemplate$1.doInHibernate(JbpmTemplate.java:87)
   at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)
   at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:339)
   at org.springmodules.workflow.jbpm31.JbpmTemplate.execute(JbpmTemplate.java:80)
   at org.alfresco.repo.workflow.jbpm.JBPMEngine.endTask(JBPMEngine.java:2504)
   … 48 more

Outcomes