cancel
Showing results for 
Search instead for 
Did you mean: 

ScheduleActions démarre un js

dranakan
Champ on-the-rise
Champ on-the-rise
Hello,

Je cherche à démarrer un script js de façon automatique. Pour ce faire il faut indiquer de démarrer le script js à ce fichier: scheduled-jobs-context.xml

J'ai un exemple pour démarrer un script présent dans "CompanyHome/Data Dictionnary/…" mais mon script ne se trouve pas dans le Data Dictionnary (il n'est pas visible ici).

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

Mon script a été créé dans un module. Il est utilisable/fonctionnel par le navigateur. Voici le chemin d'accès et son emplacement :

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

J'ai essayé d'indiquer le script de cette manière :
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

Comment puis-je y accéder à ce script depuis le Scheduled_Actions ?

(Alfresco 3.4d)
Merci bien.

Sujet lié : http://forums.alfresco.com/fr/viewtopic.php?f=13&t=4769
2 REPLIES 2

dranakan
Champ on-the-rise
Champ on-the-rise
J'ai abandonné l'idée d'utiliser le script provenant du module. J'ai donc fait une copie dans le répertoires des scripts. J'arrive à exécuter manuellement ce script mais pas de façon automatique… Le scheduled ne trouve pas le fichier….Il doit y avoir une erreur dans ma config :

opt/Alfresco/tomcat/shared/classes/alfresco/extension/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>

         <!–
        Execute the script
        –>
        <bean id="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:searchredundant.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>

        <!–
       Run the script every minute - select the single node company home that is not used …
        –>
        <bean id="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="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>

Erreur

11:22:00,055  ERROR [quartz.core.JobRunShell] Job jobGroup.jobD threw an unhandled Exception:
org.alfresco.error.AlfrescoRuntimeException: 07040007 Invalid store ref: Does not contain ://   //SpacesStore', 'lucene', 'PATH:"/app:company_home/app:dictionary/app:scripts
        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)
11:22:00,055  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: 07040007 Invalid store ref: Does not contain ://   //SpacesStore', 'lucene', 'PATH:"/app:company_home/app:dictionary/app:scripts]
        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: 07040007 Invalid store ref: Does not contain ://   //SpacesStore', 'lucene', 'PATH:"/app:company_home/app:dictionary/app:scripts
        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

Chemin vers le script (vu avec Node Broswer)

/{http://www.alfresco.org/model/application/1.0}company_home/{http://www.alfresco.org/model/applicatio...

dranakan
Champ on-the-rise
Champ on-the-rise
Il y a un bug dans 3.4D. On peut visiblement l'éviter (non testé… j'attends la 4.0a)

https://issues.alfresco.com/jira/browse/ALF-9981
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.