<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "SimpleTriggerBean not running"]]></title>
		<link>http://forums.terracotta.org/forums/posts/list/17.page</link>
		<description><![CDATA[Latest messages posted in the topic "SimpleTriggerBean not running"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>SimpleTriggerBean not running</title>
				<description><![CDATA[ Hello,

I'm trying to set up clustered scheduling with Quartz 1.6.6 with Spring and Weblogic. For some reason the scheduler is not working: in the application's logs, I have enabled debug logging and the job in question is not writing any debug information to the logs when it used to previously. I have found no error messages in any log that I can find.

I previously used a MethodInvokingJobDetailFactoryBean to do the scheduling but due to errors raised when introducing a quartz.properties file, I've had to use another approach.

My Spring application context looks like this:

<span class="genmed"><b>Code:</b></span><br>
		<div>
		<pre bbCodeId="pre-code" style="overflow: auto; width: 95%; max-height: 350px; height:expression(this.scrollHeight > 350 ? '350px' : 'auto');">
&lt;!-- myService is the Java class I'd like to run --&gt;
&lt;bean name="myJob" class="package.MyJob"&gt;
    &lt;property name="service" ref="myService"/&gt;
&lt;/bean&gt;

&lt;bean id="jobDetail" class="org.springframework.scheduling.quartz.JobDetailBean"&gt;
    &lt;property name="jobClass" value="package.GenericQuartzJob" /&gt;
    &lt;property name="jobDataAsMap"&gt;
        &lt;map&gt;
            &lt;entry key="batchProcessorName" value="myJob" /&gt;
        &lt;/map&gt;
    &lt;/property&gt;
&lt;/bean&gt;

&lt;bean id="simpleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean"&gt;
    &lt;property name="jobDetail" ref="jobDetail" /&gt;
    &lt;property name="startDelay" value="60000" /&gt;
    &lt;property name="repeatInterval" value="60000" /&gt;
&lt;/bean&gt;
    
&lt;bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"&gt;
    &lt;property name="triggers"&gt;
        &lt;list&gt;
            &lt;ref bean="simpleTrigger" /&gt;
        &lt;/list&gt;
    &lt;/property&gt;

    &lt;property name="applicationContextSchedulerContextKey"&gt;
        &lt;value&gt;applicationContext&lt;/value&gt;
    &lt;/property&gt;
&lt;/bean&gt;
</pre>
		</div>

The MyJob class implements Runnable, stores the service object as an instance variable and has this method:

<span class="genmed"><b>Code:</b></span><br>
		<div>
		<pre bbCodeId="pre-code" style="overflow: auto; width: 95%; max-height: 350px; height:expression(this.scrollHeight > 350 ? '350px' : 'auto');">
public void run&#40;&#41; {
    this.service.myMethod&#40;&#41;;
}
</pre>
		</div>

The GenericQuartzJob extends QuartzJobBean and has this method:

<span class="genmed"><b>Code:</b></span><br>
		<div>
		<pre bbCodeId="pre-code" style="overflow: auto; width: 95%; max-height: 350px; height:expression(this.scrollHeight > 350 ? '350px' : 'auto');">
@Override
protected void executeInternal&#40;final JobExecutionContext jobExecutionContext&#41;
        throws JobExecutionException {
    try {
        SchedulerContext schedulerContext = jobExecutionContext
                .getScheduler&#40;&#41;.getContext&#40;&#41;;
        ApplicationContext applicationContext = &#40;ApplicationContext&#41; schedulerContext
                .get&#40;"applicationContext"&#41;;
        Runnable processToRun = &#40;Runnable&#41; applicationContext
                .getBean&#40;this.batchProcessorName&#41;;
        processToRun.run&#40;&#41;;
    } catch &#40;Exception exception&#41; {
        throw new JobExecutionException&#40;"Unable to execute job: "
                + this.batchProcessorName, exception&#41;;
    }
}
</pre>
		</div>

The quartz.properties file is added to the EAR file under WEB-INF/classes:

<blockquote>
org.quartz.scheduler.instanceId=AUTO

org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount=1

org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.isClustered=true
&nbsp;
		</blockquote>

... and also includes connection details to the database I'm using. I have queried the database tables and it looks like the job is being run as the TIMES_TRIGGERED value for "simpleTrigger" in qrtz_simple_triggers is being incremented.

Thanks in advance for any assistance.]]></description>
				<guid isPermaLink="true">http://forums.terracotta.org/forums/posts/list/7234.page#35777</guid>
				<link>http://forums.terracotta.org/forums/posts/list/7234.page#35777</link>
				<pubDate><![CDATA[Mon, 16 Jul 2012 17:00:49]]> GMT</pubDate>
				<author><![CDATA[ Carrot]]></author>
			</item>
			<item>
				<title>Re:SimpleTriggerBean not running</title>
				<description><![CDATA[ Following on from this, I've managed to get a simpler but similar example to work.

Application context file:

<span class="genmed"><b>Code:</b></span><br>
		<div>
		<pre bbCodeId="pre-code" style="overflow: auto; width: 95%; max-height: 350px; height:expression(this.scrollHeight > 350 ? '350px' : 'auto');">
&lt;bean name="myJob" class="org.springframework.scheduling.quartz.JobDetailBean"&gt;
  &lt;property name="jobClass" value="package.MyJob" /&gt;
  &lt;property name="jobDataAsMap"&gt;
    &lt;map&gt;
      &lt;entry key="message" value="Hello world" /&gt;
    &lt;/map&gt;
  &lt;/property&gt;
&lt;/bean&gt;

&lt;bean id="myTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean"&gt;
    &lt;property name="jobDetail" ref="myJob" /&gt;
    &lt;property name="startDelay" value="60000" /&gt;
    &lt;property name="repeatInterval" value="120000" /&gt;
&lt;/bean&gt;
</pre>
		</div>

... with the MyJob class:

<span class="genmed"><b>Code:</b></span><br>
		<div>
		<pre bbCodeId="pre-code" style="overflow: auto; width: 95%; max-height: 350px; height:expression(this.scrollHeight > 350 ? '350px' : 'auto');">
@Override
protected void executeInternal&#40;final JobExecutionContext ctx&#41; throws JobExecutionException {
    LOGGER.warn&#40;"&#91;JOB&#93; " + message&#41;;
}
</pre>
		</div>

This prints out "Hello world" every two minutes to the application's log on the server.

My non-working version isn't much different, so I'm baffled as to why that one isn't working, yet this one is. Any help would be greatly appreciated.]]></description>
				<guid isPermaLink="true">http://forums.terracotta.org/forums/posts/list/7234.page#35803</guid>
				<link>http://forums.terracotta.org/forums/posts/list/7234.page#35803</link>
				<pubDate><![CDATA[Tue, 17 Jul 2012 12:42:29]]> GMT</pubDate>
				<author><![CDATA[ Carrot]]></author>
			</item>
			<item>
				<title>Re:SimpleTriggerBean not running</title>
				<description><![CDATA[ Your post is over a few months old. Were you able to figure this out. I dont see anything that stands out as odd in your configuration.
The only recommendation I would give you is to move to the latest version of quartz. The version you are using is very old.]]></description>
				<guid isPermaLink="true">http://forums.terracotta.org/forums/posts/list/7234.page#37002</guid>
				<link>http://forums.terracotta.org/forums/posts/list/7234.page#37002</link>
				<pubDate><![CDATA[Thu, 11 Oct 2012 14:13:35]]> GMT</pubDate>
				<author><![CDATA[ klalithr]]></author>
			</item>
	</channel>
</rss>