[ 
https://issues.apache.org/jira/browse/JCR-3193?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Bala Kondepudi updated JCR-3193:
--------------------------------

    Priority: Major  (was: Critical)

Reducing Priority to Major
                
> WorkflowSession.terminateWorkflow() throwing 
> javax.jcr.InvalidItemStateException
> --------------------------------------------------------------------------------
>
>                 Key: JCR-3193
>                 URL: https://issues.apache.org/jira/browse/JCR-3193
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.2.4
>         Environment: Day CQ 5.4
>            Reporter: Bala Kondepudi
>
> Hi,
> I am observing a consistent issue when trying to terminate a workflow with 
> Workflow Session terminateWorkflow() method. Pasted the code and exception 
> below.
> The termination is leaving the workflow in an incomplete state where the 
> instances is aborted or cleaned (observed that workflow is not available in 
> instances of workflow console) but the workflow lock on the payload is not 
> removed or refreshed.
> Because of this issue the payload is not eligible for any workflow process.
> <TestCase>
> public class MyWorkflowEventListener implements EventHandler, JobProcessor {
>     .
>     .
>     .
>     public boolean process(Event event) {
>         try{
>         .
>         .
>         .
>         WorkflowSession wfSession = getWorkflowSession();
>         String instanceId = (String) event
>                         .getProperty(WorkflowEvent.WORKFLOW_INSTANCE_ID);
>         Workflow workflow = (instanceId != null) ? wfSession
>                             .getWorkflow(instanceId) : null;
>         if (eventType.equals(WorkflowEvent.WORKFLOW_STARTED_EVENT)) {
>             Node jcrContentNode = ((javax.jcr.Session) 
> wfSession.getSession()).
>                                     
> getNode("/content/en_UK/home/abc/jcr:content");
>             jcrContentNode.setProperty("my_staus","TERMINATED");
>             wfSession.getSession().save();
>             session.terminateWorkflow(workflow);
>         }
>         }catch(Exception e){
>             e.printStackTrace();
>         }
>     }
>     private WorkflowSession getWorkflowSession() {
>         try {
>             Session adminSession = repository.loginAdministrative(null);
>             return workflowService.getWorkflowSession(adminSession);
>         } catch (RepositoryException e) {
>                   e.printStackTrace();
>         }
>     }
>     .
>     .
> }
> </TestCase>
> <Exception>
> Log Message: Exception block: SOME EXCEPTION OCCURRED.| Output Data: 
> com.day.cq.workflow.WorkflowException: Error occured while aborting workflow:
> /etc/workflow/instances/2011-12-23/model_16822486799933
>     at 
> com.day.cq.workflow.impl.jcr.WorkflowManager.abort(WorkflowManager.java:176)
>     at 
> com.day.cq.workflow.impl.CQWorkflowSession.terminateWorkflow(CQWorkflowSession.java:281)
>     at 
> com.abc.workflow.MyWorkflowFailTest.initializeWorkflowStart(com.abc.workflow.MyWorkflowFailTest.java:193)
>     at com.abc.workflow.MyWorkflowEventListener 
> .process(com.abc.workflow.MyWorkflowEventListener.java:111)
>     at org.apache.sling.event.jobs.JobUtil$1.run(JobUtil.java:272)
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>     at java.lang.Thread.run(Thread.java:619)
> Caused by: javax.jcr.InvalidItemStateException: 
> 114a382d-52ec-4998-969f-80b392238930 has been modified externally
>     at 
> org.apache.jackrabbit.core.ItemSaveOperation.perform(ItemSaveOperation.java:262)
>     at 
> org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:200)
>     at org.apache.jackrabbit.core.ItemImpl.perform(ItemImpl.java:91)
>     at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:329)
>     at 
> org.apache.jackrabbit.core.session.SessionSaveOperation.perform(SessionSaveOperation.java:42)
>     at 
> org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:200)
>     at org.apache.jackrabbit.core.SessionImpl.perform(SessionImpl.java:355)
>     at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:758)
>     at com.day.crx.core.CRXSessionImpl.save(CRXSessionImpl.java:126)
>     at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
>     at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:597)
>     at 
> org.apache.sling.jcr.base.SessionProxyHandler$SessionProxyInvocationHandler.invoke(SessionProxyHandler.java:109)
>     at $Proxy0.save(Unknown Source)
>     at 
> com.day.cq.workflow.impl.jcr.WorkflowManager.abort(WorkflowManager.java:173)
>     ... 7 more
> </Exception>
> Thanks,
> Bala Kondepudi

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to