Extendiendo la Workflow Console para ver la traza de WorkflowException

El problema

La consola de administración de workflows que viene con alfresco 2.1 es útil si se utiliza a nivel básico (realizar consultas y poco más … ); sin embargo cuando se intenta usar para cosas más sofisticadas empieza a mostrar sus carencias.

Por ejemplo, al intentar forzar una transición me ha saltado el error :

org.alfresco.service.cmr.workflow.WorkflowException: Failed to signal transition 'endreview' from workflow path 'jbpm$5472-@'

El problema es que no hay manera de ver qué ha pasado.

La solución

Para arreglar esto he hecho la clase que se adjunta que además del error imprime la traza en la salida (catalina.out).

Con lo que he obtenido la traza :

org.alfresco.service.cmr.workflow.WorkflowException: Failed to signal transition 'endreview' from workflow path 'jbpm$5472-@'
at org.alfresco.repo.workflow.jbpm.JBPMEngine.signal(JBPMEngine.java:876)
at org.alfresco.repo.workflow.WorkflowServiceImpl.signal(WorkflowServiceImpl.java:317)
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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:40)
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:245)
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 $Proxy40.signal(Unknown Source)
at org.alfresco.repo.workflow.WorkflowInterpreter.executeCommand(WorkflowInterpreter.java:1015)
at org.alfresco.repo.workflow.WorkflowInterpreter.access$000(WorkflowInterpreter.java:83)
at org.alfresco.repo.workflow.WorkflowInterpreter$1$1.execute(WorkflowInterpreter.java:291)
at org.alfresco.repo.workflow.WorkflowInterpreter$1$1.execute(WorkflowInterpreter.java:289)
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.WorkflowInterpreter$1.doWork(WorkflowInterpreter.java:294)
at org.alfresco.repo.workflow.WorkflowInterpreter$1.doWork(WorkflowInterpreter.java:285)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:269)
at org.alfresco.repo.workflow.WorkflowInterpreter.interpretCommand(WorkflowInterpreter.java:283)
at com.queres.HR.web.bean.workflow.WorkFlowConsoleBeanExtension.interpretCommand(WorkFlowConsoleBeanExtension.java:174)
at com.queres.HR.web.bean.workflow.WorkFlowConsoleBeanExtension.submitCommand(WorkFlowConsoleBeanExtension.java:139)
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.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:132)
at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:61)
at javax.faces.component.UICommand.broadcast(UICommand.java:109)
at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)
at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.alfresco.web.app.servlet.AdminAuthenticationFilter.doFilter(AdminAuthenticationFilter.java:80)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.jbpm.JbpmException: this token is locked by token[5472]
at org.jbpm.graph.exe.Token.signal(Token.java:184)
at org.jbpm.graph.exe.Token.signal(Token.java:157)
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.exe.Token$$EnhancerByCGLIB$$268f55ce.signal(<generated>)
at org.alfresco.repo.workflow.jbpm.JBPMEngine$17.doInJbpm(JBPMEngine.java:862)
at org.springmodules.workflow.jbpm31.JbpmTemplate$1.doInHibernate(JbpmTemplate.java:87)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:367)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:333)
at org.springmodules.workflow.jbpm31.JbpmTemplate.execute(JbpmTemplate.java:80)
at org.alfresco.repo.workflow.jbpm.JBPMEngine.signal(JBPMEngine.java:842)
... 64 more

… Ah, así que solo era un token bloqueado. De haberlo sabido antes …

Instrucciones de uso de WorkFlowConsoleExtension

Tener esta útil extension es tan fácil como descomprimir el archivo adjunto (lo subo en cuanto descubra cómo se hace 🙁 ) en

$CATALINA_HOME/webapps/alfresco/WEB-INF/classes/

y modificar  tomcat/webapps/alfresco/WEB-INF/faces-config-beans.xml de la siguiente manera:

<managed-bean>
<description>Backing bean used for the Workflow Console</description>
<managed-bean-name>WorkflowConsoleBean</managed-bean-name>
<!--<managed-bean-class>org.alfresco.web.bean.workflow.WorkflowConsoleBean</managed-bean-class>-->
<managed-bean-class>com.queres.HR.web.bean.workflow.WorkFlowConsoleBeanExtension</managed-bean-class>

….