Announcement Announcement Module
Collapse
No announcement yet.
Quartz Cluster with Spring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Quartz Cluster with Spring

    Hi All,

    Am facing some issues enabling quartz(1.6.1) clustering with spring(2.5.4/2.5.5).

    The configuration am using is :


    <bean name="clusterExBean" class="org.quartz.examples.example13.ClusterExampl e">
    <property name="inClearJobs"><value>false</value></property>
    <property name="inScheduleJobs"> <value>true</value></property>
    </bean>

    <bean id="myTrigger" class="org.springframework.scheduling.quartz.Simpl eTriggerBean">
    <property name="jobDetail" ref="methodInvokingJob" />
    <property name="startDelay" value="10000" />
    <property name="repeatInterval" value="60000" />
    </bean>

    <bean id="methodInvokingJob" class="org.springframework.scheduling.quartz.Metho dInvokingJobDetailFactoryBean">
    <property name="targetObject" ref="clusterExBean"/>
    <property name="targetMethod" value="run"/>
    </bean>

    <bean name="dataSource" class="org.springframework.jndi.JndiObjectFactoryB ean">
    <property name="jndiName" value="MyDataSource" />
    </bean>


    <bean class="org.springframework.scheduling.quartz.Sched ulerFactoryBean">
    <property name="triggers">
    <list>
    <ref bean="myTrigger"/>
    </list>
    </property>
    <property name="dataSource" ref="dataSource"/>
    <property name="applicationContextSchedulerContextKey">
    <value>applicationContext</value>
    </property>

    <property name="quartzProperties">
    <value>classpath:quartz.properties</value>
    </property>
    </bean>

    The quartz property file is :

    #================================================= ===========================
    # Configure Main Scheduler Properties
    #================================================= ===========================

    org.quartz.scheduler.instanceName = TestScheduler
    org.quartz.scheduler.instanceId = AUTO

    #================================================= ===========================
    # Configure ThreadPool
    #================================================= ===========================

    org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
    org.quartz.threadPool.threadCount = 5
    org.quartz.threadPool.threadPriority = 5

    #================================================= ===========================
    # Configure JobStore
    #================================================= ===========================

    org.quartz.jobStore.misfireThreshold = 60000

    org.quartz.jobStore.class=org.quartz.impl.jdbcjobs tore.JobStoreTX
    org.quartz.jobStore.driverDelegateClass=org.quartz .impl.jdbcjobstore.oracle.OracleDelegate
    org.quartz.jobStore.useProperties=false
    org.quartz.jobStore.tablePrefix=QRTZ_
    org.quartz.jobStore.isClustered=true

    The exception am getting is:

    ####<May 22, 2008 7:34:02 PM GMT+05:30> <Warning> <Deployer> <rahulsingh> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1211465042830> <BEA-149078> <Stack trace for message 149004
    weblogic.application.ModuleException: [HTTP:101216]Servlet: "springapp" failed to preload on startup in Web application: "springapp".
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.scheduling.quartz.SchedulerFa ctoryBean#0' defined in ServletContext resource [/WEB-INF/springapp-servlet.xml]: Invocation of init method failed; nested exception is org.quartz.JobPersistenceException: Couldn't store job: Unable to serialize JobDataMap for insertion into database because the value of property 'methodInvoker' is not serializable: org.springframework.scheduling.quartz.MethodInvoki ngJobDetailFactoryBean [See nested exception: java.io.NotSerializableException: Unable to serialize JobDataMap for insertion into database because the value of property 'methodInvoker' is not serializable: org.springframework.scheduling.quartz.MethodInvoki ngJobDetailFactoryBean]
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1336)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:471)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory$1.run(AbstractAutowireC apableBeanFactory.java:409)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:380)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 64)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:220)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:261 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:185)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:164)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:423)
    at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:729)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:381)
    at org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:4 02)
    at org.springframework.web.servlet.FrameworkServlet.i nitWebApplicationContext(FrameworkServlet.java:316 )
    at org.springframework.web.servlet.FrameworkServlet.i nitServletBean(FrameworkServlet.java:282)
    at org.springframework.web.servlet.HttpServletBean.in it(HttpServletBean.java:126)
    at javax.servlet.GenericServlet.init(GenericServlet.j ava:241)
    at weblogic.servlet.internal.StubSecurityHelper$Servl etInitAction.run(StubSecurityHelper.java:282)
    at weblogic.security.acl.internal.AuthenticatedSubjec t.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(Un known Source)
    at weblogic.servlet.internal.StubSecurityHelper.creat eServlet(StubSecurityHelper.java:63)
    at weblogic.servlet.internal.StubLifecycleHelper.crea teOneInstance(StubLifecycleHelper.java:58)
    at weblogic.servlet.internal.StubLifecycleHelper.<ini t>(StubLifecycleHelper.java:48)
    at weblogic.servlet.internal.ServletStubImpl.prepareS ervlet(ServletStubImpl.java:504)
    at weblogic.servlet.internal.WebAppServletContext.pre loadServlet(WebAppServletContext.java:1830)
    at weblogic.servlet.internal.WebAppServletContext.loa dServletsOnStartup(WebAppServletContext.java:1807)
    at weblogic.servlet.internal.WebAppServletContext.pre loadResources(WebAppServletContext.java:1727)
    at weblogic.servlet.internal.WebAppServletContext.sta rt(WebAppServletContext.java:2890)
    at weblogic.servlet.internal.WebAppModule.startContex ts(WebAppModule.java:948)
    at weblogic.servlet.internal.WebAppModule.start(WebAp pModule.java:353)
    at weblogic.application.internal.flow.ModuleStateDriv er$3.next(ModuleStateDriver.java:204)
    at weblogic.application.utils.StateMachineDriver.next State(StateMachineDriver.java:26)
    at weblogic.application.internal.flow.ModuleStateDriv er.start(ModuleStateDriver.java:60)
    at weblogic.application.internal.flow.ScopedModuleDri ver.start(ScopedModuleDriver.java:200)
    at weblogic.application.internal.flow.ModuleListenerI nvoker.start(ModuleListenerInvoker.java:117)
    at weblogic.application.internal.flow.ModuleStateDriv er$3.next(ModuleStateDriver.java:204)
    at weblogic.application.utils.StateMachineDriver.next State(StateMachineDriver.java:26)
    at weblogic.application.internal.flow.ModuleStateDriv er.start(ModuleStateDriver.java:60)
    at weblogic.application.internal.flow.StartModulesFlo w.activate(StartModulesFlow.java:26)
    at weblogic.application.internal.BaseDeployment$2.nex t(BaseDeployment.java:635)
    at weblogic.application.utils.StateMachineDriver.next State(StateMachineDriver.java:26)
    at weblogic.application.internal.BaseDeployment.activ ate(BaseDeployment.java:212)
    at weblogic.application.internal.DeploymentStateCheck er.activate(DeploymentStateChecker.java:154)
    at weblogic.deploy.internal.targetserver.AppContainer Invoker.activate(AppContainerInvoker.java:80)
    at weblogic.deploy.internal.targetserver.operations.A bstractOperation.activate(AbstractOperation.java:5 66)
    at weblogic.deploy.internal.targetserver.operations.A ctivateOperation.activateDeployment(ActivateOperat ion.java:136)
    at weblogic.deploy.internal.targetserver.operations.A ctivateOperation.doCommit(ActivateOperation.java:1 04)
    at weblogic.deploy.internal.targetserver.operations.A bstractOperation.commit(AbstractOperation.java:320 )
    at weblogic.deploy.internal.targetserver.DeploymentMa nager.handleDeploymentCommit(DeploymentManager.jav a:816)
    at weblogic.deploy.internal.targetserver.DeploymentMa nager.activateDeploymentList(DeploymentManager.jav a:1223)
    at weblogic.deploy.internal.targetserver.DeploymentMa nager.handleCommit(DeploymentManager.java:434)
    at weblogic.deploy.internal.targetserver.DeploymentSe rviceDispatcher.commit(DeploymentServiceDispatcher .java:161)
    at weblogic.deploy.service.internal.targetserver.Depl oymentReceiverCallbackDeliverer.doCommitCallback(D eploymentReceiverCallbackDeliverer.java:181)
    at weblogic.deploy.service.internal.targetserver.Depl oymentReceiverCallbackDeliverer.access$100(Deploym entReceiverCallbackDeliverer.java:12)
    at weblogic.deploy.service.internal.targetserver.Depl oymentReceiverCallbackDeliverer$2.run(DeploymentRe ceiverCallbackDeliverer.java:67)


    This looks like a know issue, but its supposed to have been solved? Am I doing something wrong?

    Do we have a work around ?

    Any pointer would be appreciated.

    Thanks in Advance
    Rahul

  • #2
    Looks like the issue

    http://jira.springframework.org/browse/SPR-2850

    is still open with Quartz 1.6.1 RC1 & Spring 2.5.5.

    Comment


    • #3
      Issue 2850 is fixed in Spring 2.5.5. The problem is your using MethodInvokingJobDetailFactoryBean together with a persistent jobstore. This is not supported, from the JavaDoc (http://static.springframework.org/sp...ctoryBean.html):

      JobDetails created via this FactoryBean are not serializable and thus not suitable for persistent job stores. You need to implement your own Quartz Job as a thin wrapper for each case where you want a persistent job to delegate to a specific service method.

      Comment


      • #4
        Thanks for the reply.

        How do I go about doing that? Any ideas or examples?

        Comment


        • #5
          Hello,

          The way I found out was to make a quartz trigger, Job and JobDetail and then use it with the spring SchedulerFactoryBean.

          Thanks,
          Rahul

          Comment


          • #6
            Originally posted by tech.sadhu View Post
            Hello,

            The way I found out was to make a quartz trigger, Job and JobDetail and then use it with the spring SchedulerFactoryBean.

            Thanks,
            Rahul
            Hi,

            I know that a lot of time has past.... but could anyone kindly post a more detailed example about how you get Quartz to work clustering ?

            Comment


            • #7
              Originally posted by tech.sadhu View Post
              Hello,

              The way I found out was to make a quartz trigger, Job and JobDetail and then use it with the spring SchedulerFactoryBean.

              Thanks,
              Rahul
              Hi

              I'm interested in some details about how to do that too.

              Thanks !

              Comment


              • #8
                spring quartz

                Hi,

                I'm beginner with spring quartz and i have a problem for my project.

                I'would whan my job is failed or sleep, the scheduler relance it and the job can retake
                where it has stopped.

                I can send you a class what do you do at this time.

                Please can i have a response, exemple or others suggestions.

                Thanks a lot

                Comment

                Working...
                X