WebSphere Scheduling with Spring and CommonJ - example
I've written down an example of how we've used the CommonJ Spring integration to set up simple scheduling on WebSphere. There doesn't seem to be very much information about this, so I thought it might be useful for others :)
The article is posted here:
Feel free to make comments/suggestions here or on the article page.
Will it work in a clustered Websphere environment?
and thanks for the nice article.
Without doing alot of research into this, do you know of any issues using commonJ in a clustered Websphere environment? We currently use Quartz to trigger jobs on the fly (i.e. they are not scheduled) to handle lengthy web requests that we poll with Ajax.
TimerManager and WorkManager with Spring under Websphere - IllegalArgumentException
I was able to get the TimerManager and WorkManager with Spring running under Websphere 6.1.
Originally Posted by eivindw
However in my batch runnable job, I need to access both TimerManager and WorkManager as the job needs to cancel or resume the timer when a piece of work is completed. I am able to access WorkManager in the job by injecting it into the bean as follows inthe spring config file:
<bean id="testRunnable"class="org.frb.ny.mg.nacs.schedul er.jobs.SampleRunnable" >
<property name="taskManager" ref="taskExecutor" /></bean>
However I am not able to do the same for the timerManager when I add the following in the config file:
class="org.frb.ny.mg.nacs.scheduler.jobs.SampleRun nable" >
<property name="taskManager" ref="taskExecutor" /><property name="dateTimerManager" ref="timerFactory" /></bean>
I get the following error:
Error 500: javax.faces.FacesException: javax.faces.el.EvaluationException: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'testRunnable' defined in ServletContext resource [/WEB-INF/resources/scheduler-context.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [com.ibm.ws.asynchbeans.timer.TimerManagerImpl] to required type [org.frb.ny.mg.nacs.scheduler.timer.DateTimerManage rFactoryBean] for property 'dateTimerManager'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [com.ibm.ws.asynchbeans.timer.TimerManagerImpl] to required type [org.frb.ny.mg.nacs.scheduler.timer.DateTimerManage rFactoryBean] for property 'dateTimerManager': no matching editors or conversion strategy found.
Not sure why the asyncbeans package from ibm is invoked, maybe the commonJ api's call it internally. Alternately, if there is a way to retrieve the application context in workerManager or the runnable job, it may be possible to retrieve the timerManager bean and then invoke - cancel the timer - in the job.
Any help /suggestions immediately would be greatly appreciated.