工作流会话在更新工作流数据

时间:2015-06-19 03:44:48

标签: cq5 aem

尝试在工作流元数据中保存一些属性,下面是我正在使用的代码片段。

try {
    if (workItem.getWorkflowData().getPayloadType().equals("JCR_PATH")) {
        addValuesToMetadata(workItem, workflowSession,metaDataMap);
    }

    MetaDataMap wfMetaData=workItem.getWorkflowData().getMetaDataMap();
    Set<String> keys=metaDataMap.keySet();
    for (String key : keys) {
        if(key.startsWith("xyz")){
            wfMetaData.put(key, metaDataMap.get(key));
        }
    }

    workflowSession.updateWorkflowData(workItem.getWorkflow(), workItem.getWorkflowData());
} catch (Exception e) {
    e.printStackTrace();
}

我没有关闭会话,但它会抛出以下异常。

  

javax.jcr.RepositoryException:此会话已关闭。在   org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.checkAlive(SessionDelegate.java:367)   在   org.apache.jackrabbit.oak.jcr.session.SessionImpl $ ReadOperation.checkPreconditions(SessionImpl.java:110)   在   org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.perform(SessionDelegate.java:289)   在   org.apache.jackrabbit.oak.jcr.session.SessionImpl.perform(SessionImpl.java:127)   在   org.apache.jackrabbit.oak.jcr.session.SessionImpl.getItemOrNull(SessionImpl.java:228)   在   org.apache.jackrabbit.oak.jcr.session.SessionImpl.getItem(SessionImpl.java:357)   at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)at   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)   在java.lang.reflect.Method.invoke(Method.java:606)at   org.apache.sling.jcr.base.SessionProxyHandler $ SessionProxyInvocationHandler.invoke(SessionProxyHandler.java:113)   在com.sun.proxy。$ Proxy0.getItem(未知来源)at   com.adobe.granite.workflow.core.jcr.WorkflowManager.getWorkflowNode(WorkflowManager.java:815)   在   com.adobe.granite.workflow.core.jcr.WorkflowManager.updateWorkflowData(WorkflowManager.java:326)   在   com.adobe.granite.workflow.core.WorkflowSessionImpl.updateWorkflowData(WorkflowSessionImpl.java:952)   在   com.adobe.granite.workflow.core.job.JobHandler.process(JobHandler.java:177)   在org.apache.sling.event.jobs.JobUtil $ 1.run(JobUtil.java:365)at at   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)   在   java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:615)   在java.lang.Thread.run(Thread.java:745)
  com.adobe.granite.workflow.WorkflowException:无法加载workItem:   的/ etc /工作流/实例/ 2015年6月18日/ model_1299575053804439 /工作项/ node7_etc_workflow_instances_2015-06-18_model_9   在   com.adobe.granite.workflow.core.jcr.WorkItemManager.updateWorkItem(WorkItemManager.java:349)   在   com.adobe.granite.workflow.core.job.JobHandler.process(JobHandler.java:180)   在org.apache.sling.event.jobs.JobUtil $ 1.run(JobUtil.java:365)at at   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)   在   java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:615)   在java.lang.Thread.run(Thread.java:745)引起:   javax.jcr.RepositoryException:此会话已关闭。在   org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.checkAlive(SessionDelegate.java:367)   在   org.apache.jackrabbit.oak.jcr.session.SessionImpl $ ReadOperation.checkPreconditions(SessionImpl.java:110)   在   org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.perform(SessionDelegate.java:289)   在   org.apache.jackrabbit.oak.jcr.session.SessionImpl.perform(SessionImpl.java:127)   在   org.apache.jackrabbit.oak.jcr.session.SessionImpl.getItemOrNull(SessionImpl.java:228)   在   org.apache.jackrabbit.oak.jcr.session.SessionImpl.getItem(SessionImpl.java:357)   at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)at   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)   在java.lang.reflect.Method.invoke(Method.java:606)at   org.apache.sling.jcr.base.SessionProxyHandler $ SessionProxyInvocationHandler.invoke(SessionProxyHandler.java:113)   在com.sun.proxy。$ Proxy0.getItem(未知来源)at   com.adobe.granite.workflow.core.jcr.WorkItemManager.updateWorkItem(WorkItemManager.java:344)   ...省略了5个常见帧

非常感谢任何帮助。

0 个答案:

没有答案