Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Wrapped javax.jcr.PathNotFoundException

Avatar

Level 2

Hi All,

I wrote an ECMA script (given below) to get the value from payload (./jcr:content/qareviewer), which i use in Dynamic Participant Step. The script was working fine early (last week). Now I am executing the workflow and for the same script exception is throwed (given below) . The page actually exist but not sure why it is not present in session. I also tried using PageManager but that did not work either. What's that i am missing here or what i have to check to get resolve this issue?

 

function getParticipant() {

var workflowData = workItem.getWorkflowData(); var path = workflowData.getPayload().toString(); var jcrsession = workflowSession.getSession();     log.info("jcrsession: "+jcrsession);     log.info("Does payload item exist in session: "+jcrsession.itemExists(path)); var node = jcrsession.getNode(path).getNode("jcr:content"); if(null != node && node.hasProperty("qareviewer")){ workflowData.getMetaDataMap().put("qareviewer",node.getProperty("qareviewer").toString()); return node.getProperty("qareviewer").toString(); }else{ return workItem.getWorkflow().getInitiator(); } }

 

 

Using PageManager:

    var pageManager = resource.getResourceResolver().adaptTo(Packages.com.day.cq.wcm.api.PageManager);
    var page = pageManager.getPage(path);
    log.info("page: "+page);
    var pageNode = page.getContentResource().adaptTo(Packages.javax.jcr.Node);

 

Error message: 

24.04.2017 16:47:01.731 *INFO* [JobHandler: /etc/workflow/instances/server0/2017-04-24/standard-content-approval-workflow_4:/content/geometrixx-outdoors/en/activities] etc.workflow.scripts.dotcom.dotcom-qa-reviewer-chooser$ecma jcrsession: session-165316 24.04.2017 16:47:01.732 *INFO* [JobHandler: /etc/workflow/instances/server0/2017-04-24/standard-content-approval-workflow_4:/content/geometrixx-outdoors/en/activities] etc.workflow.scripts.dotcom.dotcom-qa-reviewer-chooser$ecma Does payload item exist in session: false 24.04.2017 16:47:01.732 *ERROR* [JobHandler: /etc/workflow/instances/server0/2017-04-24/standard-content-approval-workflow_4:/content/geometrixx-outdoors/en/activities] com.adobe.granite.workflow.core.advance.DynamicParticipantNodeHandler Script execution resulted in an error: Failure running script /etc/workflow/scripts/dotcom/dotcom-qa-reviewer-chooser.ecma: Wrapped javax.jcr.PathNotFoundException: Node with path /content/geometrixx-outdoors/en/activities does not exist. (NO_SCRIPT_NAME#17) org.apache.sling.api.scripting.ScriptEvaluationException: Failure running script /etc/workflow/scripts/dotcom/dotcom-qa-reviewer-chooser.ecma: Wrapped javax.jcr.PathNotFoundException: Node with path /content/geometrixx-outdoors/en/activities does not exist. (NO_SCRIPT_NAME#17) at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:416) at com.adobe.granite.workflow.core.advance.DynamicParticipantNodeHandler.getParticipant(DynamicParticipantNodeHandler.java:186) at com.adobe.granite.workflow.core.advance.ParticipantNodeHandler.doTransition(ParticipantNodeHandler.java:151) at com.adobe.granite.workflow.core.advance.AdvanceUtil.transitionFrom(AdvanceUtil.java:143) at com.adobe.granite.workflow.core.WorkflowSessionImpl.completeInternal(WorkflowSessionImpl.java:916) at com.adobe.granite.workflow.core.job.HandlerBase.complete(HandlerBase.java:507) at com.adobe.granite.workflow.core.job.JobHandler.process(JobHandler.java:348) at org.apache.sling.event.impl.jobs.JobConsumerManager$JobConsumerWrapper.process(JobConsumerManager.java:500) at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.startJob(JobQueueImpl.java:291) at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.access$100(JobQueueImpl.java:58) at org.apache.sling.event.impl.jobs.queues.JobQueueImpl$1.run(JobQueueImpl.java:227) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: org.mozilla.javascript.WrappedException: Wrapped javax.jcr.PathNotFoundException: Node with path /content/geometrixx-outdoors/en/activities does not exist. (NO_SCRIPT_NAME#17) at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1893) at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:148) at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225) at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32) at org.mozilla.javascript.gen.NO_SCRIPT_NAME_109._c_getParticipant_1(NO_SCRIPT_NAME:17) at org.mozilla.javascript.gen.NO_SCRIPT_NAME_109.call(NO_SCRIPT_NAME) at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63) at org.mozilla.javascript.gen.NO_SCRIPT_NAME_109._c_script_0(NO_SCRIPT_NAME:28) at org.mozilla.javascript.gen.NO_SCRIPT_NAME_109.call(NO_SCRIPT_NAME) at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393) at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3282) at org.mozilla.javascript.gen.NO_SCRIPT_NAME_109.call(NO_SCRIPT_NAME) at org.mozilla.javascript.gen.NO_SCRIPT_NAME_109.exec(NO_SCRIPT_NAME) at org.apache.sling.scripting.javascript.internal.RhinoJavaScriptEngine$SlingCompiledScript.eval(RhinoJavaScriptEngine.java:272) at org.apache.sling.scripting.javascript.internal.RhinoJavaScriptEngine.eval(RhinoJavaScriptEngine.java:153) at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:388) ... 13 common frames omitted Caused by: javax.jcr.PathNotFoundException: Node with path /content/geometrixx-outdoors/en/activities does not exist. at org.apache.jackrabbit.oak.jcr.session.SessionImpl.getNode(SessionImpl.java:305) at sun.reflect.GeneratedMethodAccessor108.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126) ... 27 common frames omitted
2 Replies

Avatar

Level 2

Hi, Nandakumaran.

Does it work for other paths?
Could it be a permission issue?

Regards,

Daniel.

Avatar

Level 2

i am able to get the path in goto step. I printed the session id and noticed that it is different for goto step and participant step. Could be permission issue but i am logged in as admin. Is there any other approach that can be used to get path in ecma script.