Announcement Announcement Module
Collapse
No announcement yet.
Problem integrating spring with quartz Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem integrating spring with quartz

    Iīm the integration of spring with quartz.
    But iīm getting a weird problem.
    If I deploy the application, everything works fine but if i try to test the app using junit always occurs an error when spring tries to load my applicationContext.xml.
    Hereīs the error:
    <code>
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.scheduling.quartz.SchedulerFa ctoryBean' defined in class path resource [applicationContext-hibernate.xml]: Initialization of bean failed; nested exception is org.quartz.ObjectAlreadyExistsException: Unable to store Trigger with name: 'cronTrigger' and group: 'DEFAULT', because one already exists with this identification.
    org.quartz.ObjectAlreadyExistsException: .... </code>

    It seems that itīs a reported bug about this problems http://jira.atlassian.com/browse/CON...d=CCHCDNAJELAL
    (Iīm not sure if it is from OpenSymphony site, sure for my ignorance).

    Iīve already update my quartz for version 1.4.2 but itīs still occurs.
    Can anyone help me solve this problem ?
    is this an error of spring integration with quartz ? Iīve already searched it in springīs jira home page but there is nothing about this error.

    Regards,
    Vinicius Boson

  • #2
    We are having the same problem and it happens after the first test in JUnit is run. It appears to be something about not all of the context is shutdown even though we close the context in the tearDown method of the testcase.

    Anyone have any ideas?

    Comment


    • #3
      So do we

      Always after the first test.
      Is it a springīs bug or quartzīs ?

      Did any one have the same error ?

      Comment


      • #4
        I am looking into it, but I have a feeling that when the context gets closed, Spring isn't shutting down the QuartzFactory and it's sticking around in the VM.

        Comment


        • #5
          Iīve already read that there was a bug that even if you undeploy the application, the quartz still runs. Something like that.
          I donīt remeber if itīs only when itīs using with spring or by it self.
          The problem may be exactly what you told.
          Letīs find out.

          Comment


          • #6
            What's your exact environment? Currnetly I am only able to reproduce this using our maven build with the Junit tests running. Redeploying in an app server is fine.

            I am trying to reproduce it with an ant build, but having no luck.

            Comment


            • #7
              Job Already exists

              This simply means that a job with the same name and group is alreay defined in the scheduler. If you are running a JUnit test that creates a job or a trigger and then another Junit test tries to create the same name/group job then you'll get this error.

              :idea: Quartz has a method to clean up these job and triggers from the scheduler, just look in the samples directory.

              :idea: Or simply use a different name/group in each JUnit test.

              http://www.connext.co.za

              Comment


              • #8
                Hi, I also hit the same problem while trying to integrate Spring and Quartz. This error always appeared whenever i deploy the trigger, be it first time or subsequent. Appreciate if someone can help. Thanks thanks :lol:

                ========== Spring Configuration ==========

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

                <bean id="cronTrigger"
                class="org.springframework.scheduling.quartz.CronT riggerBean">
                <property name="jobDetail"><ref bean="methodInvokingJobDetail"/></property>
                <property name="cronExpression"><value>0 13 17 * * ?</value></property>
                <property name="volatility"><value>true</value></property>
                </bean>

                <bean class="org.springframework.scheduling.quartz.Sched ulerFactoryBean">
                <property name="triggers"><list><ref local="cronTrigger"/></list></property>
                </bean>

                ========== Error Log ================
                ERROR [ ContextLoader] - Context initialization failed
                org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springfr
                amework.scheduling.quartz.SchedulerFactoryBean' defined in resource [/WEB-INF/applicationContext-job
                .xml] of ServletContext: Initialization of bean failed; nested exception is org.quartz.ObjectAlready
                ExistsException: Unable to store Trigger with name: 'cronTrigger' and group: 'DEFAULT', because one
                already exists with this identification.
                org.quartz.ObjectAlreadyExistsException: Unable to store Trigger with name: 'cronTrigger' and group:
                'DEFAULT', because one already exists with this identification.
                at org.quartz.simpl.RAMJobStore.storeTrigger(RAMJobSt ore.java:309)
                at org.quartz.core.QuartzScheduler.scheduleJob(Quartz Scheduler.java:612)
                at org.quartz.impl.StdScheduler.scheduleJob(StdSchedu ler.java:232)
                at org.springframework.scheduling.quartz.SchedulerFac toryBean.afterPropertiesSet(SchedulerFa
                ctoryBean.java:301)
                at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMe
                thods(AbstractAutowireCapableBeanFactory.java:801)
                at

                Comment

                Working...
                X