AnsweredAssumed Answered

Start js script from scheduled-jobs-context.xml

Question asked by dranakan on Aug 2, 2011
Latest reply on Mar 7, 2012 by dranakan
Hello,

I want to start a js script automaticly. To do that I need to modify this file : scheduled-jobs-context.xml

I have a sample which start a js in "CompanyHome/Data Dictionnary/…" but my script is not in Data Dictionnary (I can't see it (also in other folders).

<value>${selectSingleNode('workspace://SpacesStore', 'lucene', 'PATH:"/app:company_home/cm:Record_x0020_Management/cm:testscript.js"' )}
http://wiki.alfresco.com/wiki/Scheduled_Actions

My script was created in a amp module. It is working. These are ways to access it

WEB : http://ged:8080/alfresco/service/custom/searchRedundant
Disk: /opt/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/module/custom/searchRedundant/searchRedundant.get.js

I have tried this :
scheduled-jobs-context.xml

<value>'/opt/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/module/custom/searchRedundant/searchRedundant.get.js'</value>
Erreur:

15:05:00,086  ERROR [quartz.core.JobRunShell] Job jobGroup.jobD threw an unhandled Exception:
org.alfresco.error.AlfrescoRuntimeException: 06290001 Invalid store ref: Does not contain ://   '/opt/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/module/custom/searchRedundant
        at org.alfresco.service.cmr.repository.StoreRef.<init>(StoreRef.java:75)
        at org.alfresco.service.cmr.repository.NodeRef.<init>(NodeRef.java:91)
        at org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter$17.convert(DefaultTypeConverter.java:248)
        at org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter$17.convert(DefaultTypeConverter.java:245)
        at org.alfresco.service.cmr.repository.datatype.TypeConverter.convert(TypeConverter.java:114)
        at org.alfresco.service.cmr.repository.datatype.TypeConverter.convert(TypeConverter.java:68)
        at org.alfresco.repo.action.scheduled.SimpleTemplateActionDefinition.getAction(SimpleTemplateActionDefinition.java:200)
        at org.alfresco.repo.action.scheduled.CronScheduledQueryBasedTemplateActionDefinition.getAction(CronScheduledQueryBasedTemplateActionDefinition.java:262)
        at org.alfresco.repo.action.scheduled.AbstractScheduledAction$JobDefinition$1$2.execute(AbstractScheduledAction.java:564)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:381)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:253)
        at org.alfresco.repo.action.scheduled.AbstractScheduledAction$JobDefinition$1.runTransactionalAction(AbstractScheduledAction.java:558)
        at org.alfresco.repo.action.scheduled.AbstractScheduledAction$JobDefinition$1.doWork(AbstractScheduledAction.java:426)
        at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:508)
        at org.alfresco.repo.action.scheduled.AbstractScheduledAction$JobDefinition.execute(AbstractScheduledAction.java:392)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
15:05:00,088  ERROR [quartz.core.ErrorLogger] Job (jobGroup.jobD threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: org.alfresco.error.AlfrescoRuntimeException: 06290001 Invalid store ref: Does not contain ://   '/opt/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/module/custom/searchRedundant]
        at org.quartz.core.JobRunShell.run(JobRunShell.java:227)
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
Caused by: org.alfresco.error.AlfrescoRuntimeException: 06290001 Invalid store ref: Does not contain ://   '/opt/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/module/custom/searchRedundant
        at org.alfresco.service.cmr.repository.StoreRef.<init>(StoreRef.java:75)
        at org.alfresco.service.cmr.repository.NodeRef.<init>(NodeRef.java:91)
        at org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter$17.convert(DefaultTypeConverter.java:248)
        at org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter$17.convert(DefaultTypeConverter.java:245)
        at org.alfresco.service.cmr.repository.datatype.TypeConverter.convert(TypeConverter.java:114)
        at org.alfresco.service.cmr.repository.datatype.TypeConverter.convert(TypeConverter.java:68)
        at org.alfresco.repo.action.scheduled.SimpleTemplateActionDefinition.getAction(SimpleTemplateActionDefinition.java:200)
        at org.alfresco.repo.action.scheduled.CronScheduledQueryBasedTemplateActionDefinition.getAction(CronScheduledQueryBasedTemplateActionDefinition.java:262)
        at org.alfresco.repo.action.scheduled.AbstractScheduledAction$JobDefinition$1$2.execute(AbstractScheduledAction.java:564)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:381)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:253)
        at org.alfresco.repo.action.scheduled.AbstractScheduledAction$JobDefinition$1.runTransactionalAction(AbstractScheduledAction.java:558)
        at org.alfresco.repo.action.scheduled.AbstractScheduledAction$JobDefinition$1.doWork(AbstractScheduledAction.java:426)
        at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:508)
        at org.alfresco.repo.action.scheduled.AbstractScheduledAction$JobDefinition.execute(AbstractScheduledAction.java:392)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
        … 1 more

How can I access my js file from Scheduled_Actions ?

(Alfresco 3.4d)
Thank you

(On fr : http://forums.alfresco.com/fr/viewtopic.php?f=25&t=5122#p23546)

Outcomes