Las tareas programadas tambien ejecutan scripts robustos

cancel
Showing results for 
Search instead for 
Did you mean: 
julianl
Active Member

Las tareas programadas tambien ejecutan scripts robustos

Buenos días, He creado varias tareas y las he colocado en C:\alfresco-community\tomcat\shared\classes\alfresco\extension. 

Solo hay una que no ejecuta que es la que  tiene que realizar un trabajo mas pesado. El script esta bueno, la tarea también, saben que es lo que sucede. Mi hipótesis es que el script tiene una tarea un tanto larga por eso no se ejecuta. Que opinan ustedes desde su experiencia.

Muchas gracias, feliz día.

8 Replies
cesarista
Customer

Re: Las tareas programadas tambien ejecutan scripts robustos

Hola:

Yo probaría a escribir loggers intermedios en el código de la tarea programada (logger.warn() el API javascript), para ver si empieza la tarea programada, realiza pasos intermedios o llega a algún punto.

Saludos.

--C,

julianl
Active Member

Re: Las tareas programadas tambien ejecutan scripts robustos

Hola Cesar y gracias, te pregunto algo:

Cuantas tareas programadas (xml) puedo agregar en la ruta C:\alfresco-community\tomcat\shared\classes\alfresco\extension. 

Gracias,

julianl
Active Member

Re: Las tareas programadas tambien ejecutan scripts robustos

Hola Cesar me salio esto en el log. Desde tu conocimiento sabes de que se trata. Muchas gracias.

2017-07-10 16:01:35,587 ERROR [org.quartz.core.JobRunShell] [DefaultScheduler_Worker-7] Job jobGroup.jobD threw an unhandled Exception:
org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'script': Singleton bean creation not allowed while the singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:210)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1123)
at org.alfresco.repo.action.ActionServiceImpl.getActionDefinition(ActionServiceImpl.java:286)
at org.alfresco.repo.action.ActionServiceImpl.getTrackStatus(ActionServiceImpl.java:667)
at org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:811)
at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:581)
at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:567)
at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:855)
at sun.reflect.GeneratedMethodAccessor833.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:41)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:53)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:166)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy41.executeAction(Unknown Source)
at org.alfresco.repo.action.scheduled.AbstractScheduledAction$JobDefinition$1$2.execute(AbstractScheduledAction.java:574)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:464)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:333)
at org.alfresco.repo.action.scheduled.AbstractScheduledAction$JobDefinition$1.runTransactionalAction(AbstractScheduledAction.java:564)
at org.alfresco.repo.action.scheduled.AbstractScheduledAction$JobDefinition$1.doWork(AbstractScheduledAction.java:433)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:555)
at org.alfresco.repo.action.scheduled.AbstractScheduledAction$JobDefinition.execute(AbstractScheduledAction.java:399)
at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:563)
2017-07-10 16:01:35,605 ERROR [org.quartz.core.ErrorLogger] [DefaultScheduler_Worker-7] Job (jobGroup.jobD threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'script': Singleton bean creation not allowed while the singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)]
at org.quartz.core.JobRunShell.run(JobRunShell.java:227)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:563)
Caused by: org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'script': Singleton bean creation not allowed while the singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:210)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1123)
at org.alfresco.repo.action.ActionServiceImpl.getActionDefinition(ActionServiceImpl.java:286)
at org.alfresco.repo.action.ActionServiceImpl.getTrackStatus(ActionServiceImpl.java:667)
at org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:811)
at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:581)
at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:567)
at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:855)
at sun.reflect.GeneratedMethodAccessor833.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:41)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:53)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:166)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy41.executeAction(Unknown Source)
at org.alfresco.repo.action.scheduled.AbstractScheduledAction$JobDefinition$1$2.execute(AbstractScheduledAction.java:574)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:464)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:333)
at org.alfresco.repo.action.scheduled.AbstractScheduledAction$JobDefinition$1.runTransactionalAction(AbstractScheduledAction.java:564)
at org.alfresco.repo.action.scheduled.AbstractScheduledAction$JobDefinition$1.doWork(AbstractScheduledAction.java:433)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:555)
at org.alfresco.repo.action.scheduled.AbstractScheduledAction$JobDefinition.execute(AbstractScheduledAction.java:399)
at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
... 1 more

cesarista
Customer

Re: Las tareas programadas tambien ejecutan scripts robustos

Pues no hay exactamente un límite predeterminado. Alfresco tiene unas 20 definidas por defecto. Puedes ver todas las tareas definidas y programadas con el modulo OOTB Support Tools.

GitHub - OrderOfTheBee/ootbee-support-tools: OOTBee Support Tools addon to extend set of administrat... 

Saludos.

--C.

cesarista
Customer

Re: Las tareas programadas tambien ejecutan scripts robustos

Parece que no le gusta como se define el job al crear el bean.

2017-07-10 16:01:35,587 ERROR [org.quartz.core.JobRunShell] [DefaultScheduler_Worker-7] Job jobGroup.jobD threw an unhandled Exception:
org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'script': Singleton bean creation not allowed while the singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)

No dice mucho, si pones el bean de definición de la tarea te puedo decir algo más, en cualquier caso "script" no parece un nombre bueno.

--C.

julianl
Active Member

Re: Las tareas programadas tambien ejecutan scripts robustos

Hola Cesar Capillas La tarea programada la saque del hilo https://community.alfresco.com/message/812583-re-como-ejecutar-una-regla-cada-cierto-tiempo?commentI...    donde Douglas C. R. Paes da soluciones.

Te agrego Cesar, que tengo dos tareas, Las nombro notificacion1-context.xml y notificacion2-context.xml. Este mismo codigo xml para ambas pero le cambio el nombre del script. Solo me ejecuta una tarea. Eso esta un poco raro. Que pena contigo de verdad pero si das con una solución agradecería que me la hicieras saber. Muchas gracias a ti y a quien pueda colaborarme. Feliz dia

<?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="alfresco_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', 'fts-alfresco', 'PATH:"/app:company_home/app:dictionary/app:scripts/cm:notificacion.js"')\}</value>   <!--en vez de notificacion el nombre de tu  script -->
</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="alfresco_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>
<!-- Find all nodes that do not have the aspect -->
<property name="queryTemplate">
<value>PATH:"/app:company_home"</value>
</property>
<property name="cronExpression">
<value>15 * * * * ?</value>
</property>
<property name="jobName">
<value>jobD</value>
</property>
<property name="jobGroup">
<value>jobGroup</value>
</property>
<property name="triggerName">
<value>triggerA</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="alfresco_runScriptAction"/>
</property>
<property name="transactionService">
<ref bean="TransactionService"/>
</property>
<property name="runAsUser">
<value>System</value>
</property>
</bean>
</beans>

cesarista
Customer

Re: Las tareas programadas tambien ejecutan scripts robustos

Buenas Julian:

Creo que al tener dos, se te solapa la definición y da errores.

Yo pondría en el actionName (en donde pones script):

<property name="actionName">
<value>scriptNotificacion1</value>

y en la otra tarea scriptNotificacion2

Por otro lado, a la hora de declarar el job:

<property name="jobName">
<value>jobD</value>
</property>
<property name="jobGroup">
<value>jobGroup</value>
</property>
<property name="triggerName">
<value>triggerA</value>
</property>
<property name="triggerGroup">
<value>triggerGroup</value>
</property>

En vez de jobD, pon jobNotificacion1 en la tarea 1 y jobNotificacion2 en la tarea 2. Y lo mismo con el triggerName, triggerNotificacion1 y triggerNotificacion2 respectivamente.

Saludos.

--C.

douglascrp
Advanced II

Re: Las tareas programadas tambien ejecutan scripts robustos

Cuanto tiempo lleva para encerrar una execución normalmente?

Me parece que su cron expresion estás configurada para ejecutar su script cada 15 segundos:
15 * * * * ?

Qué acontece se usted configura para ejetuar con menor frecuencia? Algo como a cada una hora?