Hi,
While loading the scheduler through the web app, application is throwing the below error.
2007-05-29 19:41:16,567 ERROR [org.springframework.web.context.ContextLoader] - Context initialization failed
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'scheduler' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'cronProperties' while setting bean property 'jobDetail'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'cronProperties' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'jobDetail1' while setting bean property 'jobDetail'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'jobDetail1' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodException: java.lang.String.run()
Caused by:
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'cronProperties' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'jobDetail1' while setting bean property 'jobDetail'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'jobDetail1' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodException: java.lang.String.run()
Caused by:
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'jobDetail1' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodException: java.lang.String.run()
Caused by:
java.lang.NoSuchMethodException: java.lang.String.run()
at java.lang.Class.getMethod(Class.java:1581)
Properties
Code:web.xml <!-- Leave the listener commented-out if using JBoss --> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> -------------------------- applicationcontext.xml <beans> <!-- Quartz Scheduler, with pre-registered triggers --> <!-- Will automatically start scheduling on context startup --> <bean name="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="jobDetail" ref="cronProperties" /> </bean> <!-- Trigger for the job defined above --> <!-- Registered by the 'scheduler' bean --> <bean id="cronProperties" class="org.springframework.scheduling.quartz.CronTriggerBean"> <property name="jobDetail" ref="jobDetail1"/> <property name="cronExpression" value="0/5 * * * * ?"/> </bean> <bean id="jobDetail1" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetObject" value="com.elift.component.scheduler.job.JobActiveAssociateMail" /> <property name="targetMethod" value="run" /> </bean> ---------------- Java code public class JobActiveAssociateMail { // protected void executeInternal(JobExecutionContext arg0) throws JobExecutionException { // System.out.println("Scheduler started"); // // } public void run(){ System.out.println("Scheduler started"); } }


Reply With Quote
