cancel
Showing results for 
Search instead for 
Did you mean: 

Error execute script document-workflows.get.js

user21
Champ in-the-making
Champ in-the-making
Hello, after upgrading my alfresco from 3.4.c to 4.0.c, i get this error, when open document in Repository:
    Exception: org.mozilla.javascript.JavaScriptException - [object Error] (file:/usr/local/alfresco/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/document-details/document-workflows.get.js#903)
    org.mozilla.javascript.gen.c41._c22(file:/usr/local/alfresco/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/document-details/document-workflows.get.js:903)
    org.mozilla.javascript.gen.c41.call(file:/usr/local/alfresco/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/document-details/document-workflows.get.js)
    org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76)
    org.mozilla.javascript.gen.c41._c40(file:/usr/local/alfresco/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/document-details/document-workflows.get.js:1515)
    org.mozilla.javascript.gen.c41.call(file:/usr/local/alfresco/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/document-details/document-workflows.get.js)
    org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
    org.mozilla.javascript.gen.c41._c41(file:/usr/local/alfresco/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/document-details/document-workflows.get.js:1528)
    org.mozilla.javascript.gen.c41.call(file:/usr/local/alfresco/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/document-details/document-workflows.get.js)
    org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:108)
    org.mozilla.javascript.gen.c41._c0(file:/usr/local/alfresco/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/document-details/document-workflows.get.js:1532)
    org.mozilla.javascript.gen.c41.call(file:/usr/local/alfresco/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/document-details/document-workflows.get.js)
    org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
    org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
    org.mozilla.javascript.gen.c41.call(file:/usr/local/alfresco/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/document-details/document-workflows.get.js)
    org.mozilla.javascript.gen.c41.exec(file:/usr/local/alfresco/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/document-details/document-workflows.get.js)
    org.springframework.extensions.webscripts.processor.JSScriptProcessor.executeScriptImpl(JSScriptProcessor.java:318)
    org.springframework.extensions.webscripts.processor.JSScriptProcessor.executeScript(JSScriptProcessor.java:192)
    org.springframework.extensions.webscripts.AbstractWebScript.executeScript(AbstractWebScript.java:1194)
    org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:86)
    org.springframework.extensions.webscripts.PresentationContainer.executeScript(PresentationContainer.java:70)
    org.springframework.extensions.webscripts.LocalWebScriptRuntimeContainer.executeScript(LocalWebScriptRuntimeContainer.java:239)
    org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:372)
    org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
    org.springframework.extensions.webscripts.WebScriptProcessor.executeBody(WebScriptProcessor.java:311)
    org.springframework.extensions.surf.render.AbstractProcessor.execute(AbstractProcessor.java:57)
    org.springframework.extensions.surf.render.RenderService.process(RenderService.java:600)
    org.springframework.extensions.surf.render.RenderService.renderSubComponent(RenderService.java:506)
    org.springframework.extensions.surf.render.RenderService.renderChromeInclude(RenderService.java:1296)
    org.springframework.extensions.webscripts.ChromeIncludeFreeMarkerDirective.execute(ChromeIncludeFreeMarkerDirective.java:81)
    freemarker.core.Environment.visit(Environment.java:274)
    freemarker.core.UnifiedCall.accept(UnifiedCall.java:126)
    freemarker.core.Environment.visit(Environment.java:221)
    freemarker.core.MixedContent.accept(MixedContent.java:92)
    freemarker.core.Environment.visit(Environment.java:221)
    freemarker.core.IfBlock.accept(IfBlock.java:82)
    freemarker.core.Environment.visit(Environment.java:221)
    freemarker.core.MixedContent.accept(MixedContent.java:92)
    freemarker.core.Environment.visit(Environment.java:221)
    freemarker.core.Environment.process(Environment.java:199)
    org.springframework.extensions.webscripts.processor.FTLTemplateProcessor.process(FTLTemplateProcessor.java:171)
    org.springframework.extensions.webscripts.WebTemplateProcessor.executeBody(WebTemplateProcessor.java:455)
    org.springframework.extensions.surf.render.AbstractProcessor.execute(AbstractProcessor.java:57)
    org.springframework.extensions.surf.render.RenderService.processRenderable(RenderService.java:204)
    org.springframework.extensions.surf.render.bean.ChromeRenderer.body(ChromeRenderer.java:95)
    org.springframework.extensions.surf.render.AbstractRenderer.render(AbstractRenderer.java:77)
    org.springframework.extensions.surf.render.bean.ChromeRenderer.render(ChromeRenderer.java:86)
    org.springframework.extensions.surf.render.RenderService.processComponent(RenderService.java:433)
    org.springframework.extensions.surf.render.bean.ComponentRenderer.body(ComponentRenderer.java:94)
    org.springframework.extensions.surf.render.AbstractRenderer.render(AbstractRenderer.java:77)
    org.springframework.extensions.surf.render.RenderService.renderComponent(RenderService.java:962)
    org.springframework.extensions.surf.render.RenderService.renderRegionComponents(RenderService.java:901)
    org.springframework.extensions.surf.render.RenderService.renderChromeInclude(RenderService.java:1275)
    org.springframework.extensions.webscripts.ChromeIncludeFreeMarkerDirective.execute(ChromeIncludeFreeMarkerDirective.java:81)
    freemarker.core.Environment.visit(Environment.java:274)
    freemarker.core.UnifiedCall.accept(UnifiedCall.java:126)
    freemarker.core.Environment.visit(Environment.java:221)
    freemarker.core.MixedContent.accept(MixedContent.java:92)
    freemarker.core.Environment.visit(Environment.java:221)
    freemarker.core.Environment.process(Environment.java:199)
    org.springframework.extensions.webscripts.processor.FTLTemplateProcessor.process(FTLTemplateProcessor.java:171)
    org.springframework.extensions.webscripts.WebTemplateProcessor.executeBody(WebTemplateProcessor.java:455)
    org.springframework.extensions.surf.render.AbstractProcessor.execute(AbstractProcessor.java:57)
    org.springframework.extensions.surf.render.RenderService.processRenderable(RenderService.java:204)
    org.springframework.extensions.surf.render.bean.ChromeRenderer.body(ChromeRenderer.java:95)
    org.springframework.extensions.surf.render.AbstractRenderer.render(AbstractRenderer.java:77)
    org.springframework.extensions.surf.render.bean.ChromeRenderer.render(ChromeRenderer.java:86)
    org.springframework.extensions.surf.render.bean.RegionRenderer.body(RegionRenderer.java:99)
    org.springframework.extensions.surf.render.AbstractRenderer.render(AbstractRenderer.java:77)
    org.springframework.extensions.surf.render.RenderService.renderRegion(RenderService.java:852)
    org.springframework.extensions.surf.extensibility.impl.RegionDirectiveData.render(RegionDirectiveData.java:90)
    org.springframework.extensions.surf.extensibility.impl.ExtensibilityModelImpl.merge(ExtensibilityModelImpl.java:319)
    org.springframework.extensions.surf.extensibility.impl.AbstractExtensibilityDirective.merge(AbstractExtensibilityDirective.java:177)
    org.springframework.extensions.surf.extensibility.impl.AbstractExtensibilityDirective.execute(AbstractExtensibilityDirective.java:145)
    freemarker.core.Environment.visit(Environment.java:274)
    freemarker.core.UnifiedCall.accept(UnifiedCall.java:126)
    freemarker.core.Environment.visit(Environment.java:221)
    freemarker.core.MixedContent.accept(MixedContent.java:92)
    freemarker.core.Environment.visit(Environment.java:221)
    freemarker.core.Environment.visit(Environment.java:406)
    freemarker.core.BodyInstruction.accept(BodyInstruction.java:93)
    freemarker.core.Environment.visit(Environment.java:221)
    freemarker.core.MixedContent.accept(MixedContent.java:92)
    freemarker.core.Environment.visit(Environment.java:221)
    freemarker.core.Macro$Context.runMacro(Macro.java:172)
    freemarker.core.Environment.visit(Environment.java:614)
    freemarker.core.UnifiedCall.accept(UnifiedCall.java:106)
    freemarker.core.Environment.visit(Environment.java:221)
    freemarker.core.MixedContent.accept(MixedContent.java:92)
    freemarker.core.Environment.visit(Environment.java:221)
    freemarker.core.Environment.process(Environment.java:199)
    org.springframework.extensions.webscripts.processor.FTLTemplateProcessor.process(FTLTemplateProcessor.java:171)
    org.springframework.extensions.webscripts.WebTemplateProcessor.executeBody(WebTemplateProcessor.java:455)
    org.springframework.extensions.surf.render.AbstractProcessor.execute(AbstractProcessor.java:57)
    org.springframework.extensions.surf.render.RenderService.processTemplate(RenderService.java:722)
    org.springframework.extensions.surf.render.bean.TemplateInstanceRenderer.body(TemplateInstanceRenderer.java:123)
    org.springframework.extensions.surf.render.AbstractRenderer.render(AbstractRenderer.java:77)
    org.springframework.extensions.surf.render.bean.PageRenderer.body(PageRenderer.java:85)
    org.springframework.extensions.surf.render.AbstractRenderer.render(AbstractRenderer.java:77)
    org.springframework.extensions.surf.render.RenderService.renderPage(RenderService.java:763)
    org.springframework.extensions.surf.mvc.PageView.dispatchPage(PageView.java:419)
    org.springframework.extensions.surf.mvc.PageView.renderView(PageView.java:314)
    org.springframework.extensions.surf.mvc.AbstractWebFrameworkView.renderMergedOutputModel(AbstractWebFrameworkView.java:316)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    org.alfresco.web.site.servlet.MTAuthenticationFilter.doFilter(MTAuthenticationFilter.java:74)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    org.alfresco.web.site.servlet.SSOAuthenticationFilter.doFilter(SSOAuthenticationFilter.java:307)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    java.lang.Thread.run(Thread.java:662)
    Exception: org.springframework.extensions.webscripts.WebScriptException - 01270005 Error: Could not load document workflows for workspace://SpacesStore/411d4926-059c-4f47-8291-7a9a91978539 (file:/usr/local/alfresco/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/document-details/document-workflows.get.js#903)
    org.springframework.extensions.webscripts.processor.JSScriptProcessor.executeScriptImpl(JSScriptProcessor.java:328)
    Exception: org.springframework.extensions.webscripts.WebScriptException - 01270006 Failed to execute script 'classpath*:alfresco/site-webscripts/org/alfresco/components/document-details/document-workflows.get.js': 01270005 Error: Could not load document workflows for workspace://SpacesStore/411d4926-059c-4f47-8291-7a9a91978539 (file:/usr/local/alfresco/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/document-details/document-workflows.get.js#903)
    org.springframework.extensions.webscripts.processor.JSScriptProcessor.executeScript(JSScriptProcessor.java:200)
I compared document-workflows.get.js in both versions(3.4.c and 4.0.c) it's different.


document-workflows.get.js 3.4.0c
function main()
{
   if (args.nodeRef != null)
   {
      var nodeRef = args.nodeRef;
     
      // Call the repo to get the workflows this node is part of
      var response = remote.call("/api/node/" + nodeRef.replace(":/", "") + "/workflow-instances");
     
      // Create javascript objects from the server response
      var workflows = [];
     
      if (response.status == 200)
      {
         var result = eval('(' + response + ')');
        
         workflows = result.data;
      }
     
      // Prepare the model for the template
      model.nodeRef = nodeRef;
      model.workflows = workflows;
   }
}

main();


document-workflows.get.js 4.0.c
<import resource="classpath:/alfresco/templates/org/alfresco/import/alfresco-util.js">

function getDocumentWorkflows(nodeRef)
{
   var result = remote.call("/api/node/" + nodeRef.replace(":/", "") + "/workflow-instances");
   if (result.status != 200)
   {
      AlfrescoUtil.error(result.status, 'Could not load document workflows for ' + nodeRef);
   }
   return eval('(' + result + ')').data;
}

function main()
{
   AlfrescoUtil.param('nodeRef');
   AlfrescoUtil.param('site', null);
   var documentDetails = AlfrescoUtil.getNodeDetails(model.nodeRef, model.site);
   if (documentDetails)
   {
      model.destination = documentDetails.item.parent.nodeRef
      model.workflows = getDocumentWorkflows(model.nodeRef);
   }
}

main();

What can i do, to resolve this problem?
6 REPLIES 6

jpotts
World-Class Innovator
World-Class Innovator
You're going to have to debug it. It looks like Share is getting a bad response from the repository tier web script it is invoking to find the workflows for a given document.

As you can see in the Share tier controller, the repository tier web script being invoked is:
http://localhost:8080/alfresco/s/api/node/{some node ref}/workflow-instances

You can put this into your browser and see what comes back. It might have some useful error message.

The documentation for the repository tier web script being invoked is:
http://localhost:8080/alfresco/s/script/org/alfresco/repository/workflow/workflow-instances-for-node...

Look at that and you can see the freemarker library where this logic lives, which is:
$TOMCAT_HOME/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/repository/workflow/workflow.lib.ftl

Everything in there eventually calls Java code and you have that source. So if you don't find anything helpful in the repository tier error message, set a breakpoint in the workflow API Java classes and then hit the web script again so you can step through it.

The scripts all work fine for me on 4.0.c so this is highly likely due to some sort of funky data condition caused by your upgrade.

Jeff

user21
Champ in-the-making
Champ in-the-making
Dear Jeff, thank you for your reply.
Actually I can't execute the repository tier web script, so it says 404 HTTP error or empty json data. I think the URL is incorrect.
I've tried:
http://172.172.174.111:8080/alfresco/s/api/node/{workspace://SpacesStore/5c2ac44c-1657-495d-a4d0-9a1...
http://172.172.174.111:8080/alfresco/s/api/node/{5c2ac44c-1657-495d-a4d0-9a1eaec0697e}/workflow-inst...
http://172.172.174.111:8080/alfresco/s/api/node/5c2ac44c-1657-495d-a4d0-9a1eaec0697e/workflow-instan...
there're no any results.

Could you tell me how to run this properly?

jpotts
World-Class Innovator
World-Class Innovator

user21
Champ in-the-making
Champ in-the-making
Thank you for so quick reply. Now I've understood the root cause of my error.
The error was:
{
    "code" : 500,
    "name" : "Internal Error",
    "description" : "An error inside the HTTP server which prevented it from fulfilling the request."
  }, 
 
  "message" : "060413059 Wrapped Exception (with status template): 060453144 Workflow Component for engine id 'jbpm' is not registered", 
  "exception" : "org.springframework.extensions.webscripts.WebScriptException - 060413059 Wrapped Exception (with status template): 060453144 Workflow Component for engine id 'jbpm' is not registered",

So this error happens on any document that was involved in business processes in my previous version of Alfresco 3.4. (In 3.4 it was bpmn but version 4 uses activiti)
Jeff, could you tell me how to fix this issue on all my documents? Thanks in advance!

jpotts
World-Class Innovator
World-Class Innovator
Can you set:
system.workflow.engine.jbpm.enabled=true

In your alfresco-global.properties file and restart to see if that clears it up?

Jeff

user21
Champ in-the-making
Champ in-the-making
Thank you Jeff, i put that property to my alfresco-global.properties and restart alfresco, but error is still showing Smiley Sad