Alfresco 6.1 scheduled job

cancel
Showing results for 
Search instead for 
Did you mean: 
sandhya_nair
Partner

Alfresco 6.1 scheduled job

Jump to solution

Hi,

I want to create a scheduled job for alfresco 6.1. I am getting the below error for the class.

Caused by: java.lang.ClassNotFoundException: org.springframework.scheduling.quartz.JobDetailBean

<bean id="org.alfresco.tutorial.scheduledjob.actions.ScheduledJobExecuter"
class="org.alfresco.tutorial.scheduledjob.actions.ScheduledJobExecuter">
<property name="serviceRegistry">
<ref bean="ServiceRegistry" />
</property>
</bean>

<bean id="org.alfresco.tutorial.scheduledjob.jobDetail"
class="org.springframework.scheduling.quartz.JobDetailFactoryBean">
<property name="jobClass">
<value>org.alfresco.tutorial.scheduledjob.jobs.ScheduledJob</value>
</property>
<property name="jobDataAsMap">
<map>
<entry key="jobExecuter">
<ref bean="org.alfresco.tutorial.scheduledjob.actions.ScheduledJobExecuter" />
</entry>
<entry key="jobLockService">
<ref bean="jobLockService" />
</entry>
</map>
</property>
</bean>

<bean id="org.alfresco.tutorial.scheduledjob.trigger"
class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail">
<ref bean="org.alfresco.tutorial.scheduledjob.jobDetail" />
</property>
<property name="cronExpression">
<value>${org.alfresco.tutorial.scheduledjob.cronexpression}</value>
</property>
<property name="startDelay">
<value>${org.alfresco.tutorial.scheduledjob.cronstartdelay}</value>
</property>
</bean>

<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="org.alfresco.tutorial.scheduledjob.trigger"/>
</list>
</property>
</bean>

I have changed the class to org.springframework.scheduling.quartz.JobDetailFactoryBean & org.springframework.scheduling.quartz.CronTriggerFactoryBean, then the class not found exception is gone but the job is not running.

Has anyone created a scheduled job alfresco 6.1 SDK 4?

1 Solution

Accepted Solutions
sandhya_nair
Partner

Re: Alfresco 6.1 scheduled job

Jump to solution

I have found the solution for this. the below link is not an updated one.

Scheduled Jobs | Alfresco Documentation 

Below configration is working.

<?xml version='1.0' encoding='UTF-8'?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

<bean id="schedulerAccessor"
class="org.springframework.scheduling.quartz.SchedulerAccessorBean">
<property name="scheduler" ref="schedulerFactory" />
<property name="triggers">
<list>
<ref bean="testJobTrigger" />
</list>
</property>
</bean>

<bean id="testJobTrigger"
class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="cronExpression" value="0 0/2 * * * ?" />
<property name="startDelay" value="${system.cronJob.startDelayMilliseconds}" />
<property name="jobDetail">
<bean class="org.springframework.scheduling.quartz.JobDetailFactoryBean">
<property name="jobClass" value="org.alfresco.tutorial.scheduledjob.actions.ScheduledJobExecuter" />
<property name="jobDataAsMap">
<map>
<entry key="jobLockService">
<ref bean="jobLockService" />
</entry>
</map>
</property>
</bean>
</property>
</bean>

</beans>

View solution in original post

2 Replies
sandhya_nair
Partner

Re: Alfresco 6.1 scheduled job

Jump to solution

I have found the solution for this. the below link is not an updated one.

Scheduled Jobs | Alfresco Documentation 

Below configration is working.

<?xml version='1.0' encoding='UTF-8'?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

<bean id="schedulerAccessor"
class="org.springframework.scheduling.quartz.SchedulerAccessorBean">
<property name="scheduler" ref="schedulerFactory" />
<property name="triggers">
<list>
<ref bean="testJobTrigger" />
</list>
</property>
</bean>

<bean id="testJobTrigger"
class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="cronExpression" value="0 0/2 * * * ?" />
<property name="startDelay" value="${system.cronJob.startDelayMilliseconds}" />
<property name="jobDetail">
<bean class="org.springframework.scheduling.quartz.JobDetailFactoryBean">
<property name="jobClass" value="org.alfresco.tutorial.scheduledjob.actions.ScheduledJobExecuter" />
<property name="jobDataAsMap">
<map>
<entry key="jobLockService">
<ref bean="jobLockService" />
</entry>
</map>
</property>
</bean>
</property>
</bean>

</beans>

afaust
Master

Re: Alfresco 6.1 scheduled job

Jump to solution

Alfresco 6.x has updated Quartz libraries. This has changed how jobs need to be registered a bit, so most of the examples you can find on the internet won't work because they address versions of Alfresco before 6.x. You can look at the Alfresco source code itself to find how jobs can be registered now.