cancel
Showing results for 
Search instead for 
Did you mean: 

Scheduling script Error

arpa1986
Champ in-the-making
Champ in-the-making
Hello

I am trying execute an javascript in a schedule configuration xml(scheduled-action-services-context.xml), but I am getting the next error message:


ERROR [freemarker.runtime] Template processing error: "No nodes selected"

No nodes selected
The problematic instruction:
———-
==> ${selectSingleNode('workspace://SpacesStore','lucene','PATH:"/app:company_home/app:dictionary/app:scripts/cm:scriptTaskfolder.js"')} [on line 1, column 1 in string://fixed]
———-

Java backtrace for programmers:
———-
freemarker.template.TemplateModelException: No nodes selected

Thanks for help,

Andres


2 REPLIES 2

g_rathod
Star Contributor
Star Contributor
Hi ,

It seems some syntax kind of error :
Can you try like below :

<value>\$\{selectSingleNode('workspace://SpacesStore', 'lucene', 'PATH:"/app:company_home/app:dictionary/app:scripts/cm:scriptTaskfolder.js"' )\}</value>

arpa1986
Champ in-the-making
Champ in-the-making
Hi,

I fixed the XML file configuration(scheduled-action-services-context.xml).  I did test the javascript file(scriptTaskFolder.js)


logger.log( "Begin script: scriptTaskFolder.js" );

var sourceFolder = companyhome.childByNamePath("Pruebas");
var histFolder = companyhome.childByNamePath("PruebasArchivos");
if(sourceFolder != null){
var i=0;
sourceChildren = sourceFolder.children;
for(i=0; i<sourceChildren.length;i++){
child = sourceChildren[i];
child.move(histFolder);
}
}

logger.log( "End script: scriptTaskFolder.js" );

When the script is executed manually(on alfresco explorer), the script was executed sucesfully, follow the log :


12:46:22,861 DEBUG [org.alfresco.repo.jscript.ScriptLogger] Begin script: scriptTaskFolder.js
12:46:22,941 DEBUG [org.alfresco.repo.jscript.ScriptLogger] End script: scriptTaskFolder.js


When the cron is executed with scheduled-action-services-context.xml configuration (scheduled-action-services-context.xml)

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
   
    <!–
    Define the model factory used to generate object models suitable for use with freemarker templates.
    –>
    <bean id="templateActionModelFactory" class="org.alfresco.repo.action.scheduled.FreeMarkerWithLuceneExtensionsModelFactory">
        <property name="serviceRegistry">
            <ref bean="ServiceRegistry"/>
        </property>
    </bean>
   
    <bean id="moverCarpeta_runScriptAction" class="org.alfresco.repo.action.scheduled.SimpleTemplateActionDefinition">
      <property name="actionName">
         <value>script</value>
      </property>
      <property name="parameterTemplates">
         <map>
            <entry>
               <key>
                  <value>script-ref</value>
               </key>
               <value>\$\{selectSingleNode('workspace://SpacesStore','lucene','PATH:"/app:company_home/app:dictionary/app:scripts/cm:scriptTaskFolder.js"')\}   
               </value>
            </entry>
         </map>
      </property>
      <property name="templateActionModelFactory">
         <ref bean="templateActionModelFactory"/>
      </property>
      <property name="dictionaryService">
         <ref bean="DictionaryService"/>
      </property>
      <property name="actionService">
         <ref bean="ActionService"/>
      </property>
      <property name="templateService">
         <ref bean="TemplateService"/>
      </property>
   </bean>
   
   <bean id="moverCarpeta_runScript" class="org.alfresco.repo.action.scheduled.CronScheduledQueryBasedTemplateActionDefinition">
      <property name="transactionMode">
         <value>UNTIL_FIRST_FAILURE</value>
      </property>
      <property name="compensatingActionMode">
         <value>IGNORE</value>
      </property>
      <property name="searchService">
         <ref bean="SearchService"/>
      </property>
      <property name="templateService">
         <ref bean="TemplateService"/>
      </property>
      <property name="queryLanguage">
         <value>lucene</value>
      </property>
      <property name="stores">
         <list>
            <value>workspace://SpacesStore</value>
         </list>
      </property>
      <property name="queryTemplate">
         <value>PATH:"/app:company_home"</value>
      </property>
      <property name="cronExpression">
         <value>0 0/1 * * * ?</value>
      </property>
      <property name="jobName">
         <value>jobD</value>
      </property>
      <property name="jobGroup">
         <value>jobGroup</value>
      </property>
      <property name="triggerName">
         <value>triggerD</value>
      </property>
      <property name="triggerGroup">
         <value>triggerGroup</value>
      </property>
      <property name="scheduler">
         <ref bean="schedulerFactory"/>
      </property>
      <property name="actionService">
         <ref bean="ActionService"/>
      </property>
      <property name="templateActionModelFactory">
         <ref bean="templateActionModelFactory"/>
      </property>
      <property name="templateActionDefinition">
         <ref bean="moverCarpeta_runScriptAction"/>
      <!– This is name of the action (bean) that gets run –>
      </property>
      <property name="transactionService">
         <ref bean="TransactionService"/>
      </property>
      <property name="runAsUser">
         <value>System</value>
      </property>
   </bean>

   
</beans>





After enabled the log debug for cron execution: 


2014-05-20 06:36:00,033 DEBUG [action.scheduled.AbstractScheduledAction] [DefaultScheduler_Worker-1] Found 1
2014-05-20 06:36:00,033 DEBUG [action.scheduled.AbstractScheduledAction] [DefaultScheduler_Worker-1] Executing in individual transaction
2014-05-20 06:36:00,044 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-1] Execute action impl action chain = null
2014-05-20 06:36:00,044 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-1] Current action = 33a43bbd-4b74-4216-904e-3b4b5bb88c46
2014-05-20 06:36:00,044 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-1] Doing executeActionImpl
2014-05-20 06:36:00,044 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-1] Adding script, 33a43bbd-4b74-4216-904e-3b4b5bb88c46 to action chain.
2014-05-20 06:36:00,044 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-1] All Condition Evaluation Result - true
2014-05-20 06:36:00,045 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-1] The action is being executed as the user: System
2014-05-20 06:36:00,045 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-1] Resetting the action chain.
2014-05-20 06:36:39,880 INFO [web.site.EditionInterceptor] [http-bio-80-exec-2] Unable to retrieve License information from Alfresco: 401
2014-05-20 06:37:00,018 DEBUG [action.scheduled.AbstractScheduledAction] [DefaultScheduler_Worker-4] Found 1
2014-05-20 06:37:00,018 DEBUG [action.scheduled.AbstractScheduledAction] [DefaultScheduler_Worker-4] Executing in individual transaction
2014-05-20 06:37:00,024 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-4] Execute action impl action chain = null
2014-05-20 06:37:00,024 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-4] Current action = 2891c8b0-31f4-47fd-bbbd-1bb5574f7094
2014-05-20 06:37:00,024 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-4] Doing executeActionImpl
2014-05-20 06:37:00,024 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-4] Adding script, 2891c8b0-31f4-47fd-bbbd-1bb5574f7094 to action chain.
2014-05-20 06:37:00,025 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-4] All Condition Evaluation Result - true
2014-05-20 06:37:00,025 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-4] The action is being executed as the user: System
2014-05-20 06:37:00,025 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-4] Resetting the action chain.
2014-05-20 06:38:00,015 DEBUG [action.scheduled.AbstractScheduledAction] [DefaultScheduler_Worker-5] Found 1
2014-05-20 06:38:00,016 DEBUG [action.scheduled.AbstractScheduledAction] [DefaultScheduler_Worker-5] Executing in individual transaction
2014-05-20 06:38:00,026 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-5] Execute action impl action chain = null
2014-05-20 06:38:00,026 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-5] Current action = 305adc5c-4235-423d-a7da-ef960bc76a45
2014-05-20 06:38:00,026 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-5] Doing executeActionImpl
2014-05-20 06:38:00,026 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-5] Adding script, 305adc5c-4235-423d-a7da-ef960bc76a45 to action chain.
2014-05-20 06:38:00,026 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-5] All Condition Evaluation Result - true
2014-05-20 06:38:00,026 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-5] The action is being executed as the user: System
2014-05-20 06:38:00,027 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-5] Resetting the action chain.
2014-05-20 06:39:00,014 DEBUG [action.scheduled.AbstractScheduledAction] [DefaultScheduler_Worker-10] Found 1
2014-05-20 06:39:00,014 DEBUG [action.scheduled.AbstractScheduledAction] [DefaultScheduler_Worker-10] Executing in individual transaction
2014-05-20 06:39:00,020 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-10] Execute action impl action chain = null
2014-05-20 06:39:00,021 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-10] Current action = f51dbc6c-dacd-460c-91a6-22b0db5e6cf9
2014-05-20 06:39:00,021 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-10] Doing executeActionImpl
2014-05-20 06:39:00,021 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-10] Adding script, f51dbc6c-dacd-460c-91a6-22b0db5e6cf9 to action chain.
2014-05-20 06:39:00,021 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-10] All Condition Evaluation Result - true
2014-05-20 06:39:00,021 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-10] The action is being executed as the user: System
2014-05-20 06:39:00,022 DEBUG [repo.action.ActionServiceImpl] [DefaultScheduler_Worker-10] Resetting the action chain.
The script is not executed and the files was not moving.

Thanks.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.