Results 1 to 10 of 10

Thread: Error using Quartz integration SchedulerFactoryBean

  1. #1
    Join Date
    Sep 2004
    Location
    Portland, OR
    Posts
    54

    Default Error using Quartz integration SchedulerFactoryBean

    I'm getting this error trying to schedule some simple jobs using a SchedulerFactoryBean. It works correctly when I configure Quartz to use its own DataSource, but chokes when I pass the shared DataSource (which works fine for everything else).

    The dataSource is a simple one:

    Code:
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" depends-on="placeholderConfig">
            <property name="driverClassName">
                <value>oracle.jdbc.driver.OracleDriver</value>
            </property>
            <property name="url">
                <value>$&#123;jdbc.url&#125;</value>
            </property>
            <property name="username">
                <value>$&#123;jdbc.username&#125;</value>
            </property>
            <property name="password">
                <value>$&#123;jdbc.password&#125;</value>
            </property>
            <property name="removeAbandoned">
                <value>true</value>
            </property>
            <property name="validationQuery">
                <value>select 1 from DUAL</value>
            </property>
            <property name="maxActive">
                <value>50</value>
            </property>
        </bean>
    It is also used by a LocalSessionFactoryBean and by extension an OpenSessionInViewFilter.

    The error is below:

    Code:
    ERROR &#91;main&#93; &#91;2004-09-03 16&#58;55&#58;52,654&#93; &#91;org.springframework.web.context.ContextLoader&#93;- Context initialization failed
    org.springframework.beans.factory.BeanCreationException&#58; Error creating bean with name 'schedulerFactory' defined in res
    ource &#91;/WEB-INF/classes/spring-rss.xml&#93; of ServletContext&#58; Initialization of bean failed; nested exception is org.quartz
    .impl.jdbcjobstore.LockException&#58; Failure obtaining db row lock&#58; ORA-01002&#58; fetch out of sequence
    
    org.quartz.impl.jdbcjobstore.LockException&#58; Failure obtaining db row lock&#58; ORA-01002&#58; fetch out of sequence
     &#91;See nested exception&#58; java.sql.SQLException&#58; ORA-01002&#58; fetch out of sequence
    &#93;
            at org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock&#40;StdRowLockSemaphore.java&#58;154&#41;
            at org.quartz.impl.jdbcjobstore.JobStoreCMT.storeJob&#40;JobStoreCMT.java&#58;310&#41;
            at org.quartz.core.QuartzScheduler.addJob&#40;QuartzScheduler.java&#58;646&#41;
            at org.quartz.impl.StdScheduler.addJob&#40;StdScheduler.java&#58;244&#41;
            at org.springframework.scheduling.quartz.SchedulerFactoryBean.addJobToScheduler&#40;SchedulerFactoryBean.java&#58;524&#41;
            at org.springframework.scheduling.quartz.SchedulerFactoryBean.registerJobsAndTriggers&#40;SchedulerFactoryBean.java&#58;
    486&#41;
            at org.springframework.scheduling.quartz.SchedulerFactoryBean.afterPropertiesSet&#40;SchedulerFactoryBean.java&#58;404&#41;
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods&#40;AbstractAutowi
    reCapableBeanFactory.java&#58;948&#41;
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean&#40;AbstractAutowireCapab
    leBeanFactory.java&#58;284&#41;
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean&#40;AbstractAutowireCapab
    leBeanFactory.java&#58;204&#41;
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;199&#41;
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;136&#41;
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons&#40;DefaultListable
    BeanFactory.java&#58;203&#41;
            at org.springframework.context.support.AbstractApplicationContext.refresh&#40;AbstractApplicationContext.java&#58;279&#41;
            at org.springframework.web.context.support.XmlWebApplicationContext.refresh&#40;XmlWebApplicationContext.java&#58;131&#41;
            at org.springframework.web.context.ContextLoader.createWebApplicationContext&#40;ContextLoader.java&#58;156&#41;
            at org.springframework.web.context.ContextLoader.initWebApplicationContext&#40;ContextLoader.java&#58;97&#41;
            at org.springframework.web.context.ContextLoaderListener.contextInitialized&#40;ContextLoaderListener.java&#58;48&#41;
            at org.apache.catalina.core.StandardContext.listenerStart&#40;StandardContext.java&#58;3276&#41;
            at org.apache.catalina.core.StandardContext.start&#40;StandardContext.java&#58;3618&#41;
            at org.apache.catalina.core.ContainerBase.start&#40;ContainerBase.java&#58;1188&#41;
            at org.apache.catalina.core.StandardHost.start&#40;StandardHost.java&#58;754&#41;
            at org.apache.catalina.core.ContainerBase.start&#40;ContainerBase.java&#58;1188&#41;
            at org.apache.catalina.core.StandardEngine.start&#40;StandardEngine.java&#58;363&#41;
            at org.apache.catalina.core.StandardService.start&#40;StandardService.java&#58;497&#41;
            at org.apache.catalina.core.StandardServer.start&#40;StandardServer.java&#58;2190&#41;
            at org.apache.catalina.startup.Catalina.start&#40;Catalina.java&#58;512&#41;
            at org.apache.catalina.startup.Catalina.execute&#40;Catalina.java&#58;400&#41;
            at org.apache.catalina.startup.Catalina.process&#40;Catalina.java&#58;180&#41;
            at sun.reflect.NativeMethodAccessorImpl.invoke0&#40;Native Method&#41;
            at sun.reflect.NativeMethodAccessorImpl.invoke&#40;NativeMethodAccessorImpl.java&#58;39&#41;
            at sun.reflect.DelegatingMethodAccessorImpl.invoke&#40;DelegatingMethodAccessorImpl.java&#58;25&#41;
            at java.lang.reflect.Method.invoke&#40;Method.java&#58;324&#41;
            at org.apache.catalina.startup.Bootstrap.main&#40;Bootstrap.java&#58;203&#41;
    * Nested Exception &#40;Underlying Cause&#41; ---------------
    java.sql.SQLException&#58; ORA-01002&#58; fetch out of sequence
    
            at oracle.jdbc.dbaccess.DBError.throwSqlException&#40;DBError.java&#58;168&#41;
            at oracle.jdbc.oci8.OCIDBAccess.check_error&#40;OCIDBAccess.java&#58;1597&#41;
            at oracle.jdbc.oci8.OCIDBAccess.fetch&#40;OCIDBAccess.java&#58;1410&#41;
            at oracle.jdbc.driver.OracleStatement.doExecuteQuery&#40;OracleStatement.java&#58;1681&#41;
            at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout&#40;OracleStatement.java&#58;1870&#41;
            at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate&#40;OraclePreparedStatement.java&#58;363&#41;
            at oracle.jdbc.driver.OraclePreparedStatement.executeQuery&#40;OraclePreparedStatement.java&#58;314&#41;
            at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery&#40;DelegatingPreparedStatement.java&#58;92&#41;
            at org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.obtainLock&#40;StdRowLockSemaphore.java&#58;137&#41;
            at org.quartz.impl.jdbcjobstore.JobStoreCMT.storeJob&#40;JobStoreCMT.java&#58;310&#41;
            at org.quartz.core.QuartzScheduler.addJob&#40;QuartzScheduler.java&#58;646&#41;
            at org.quartz.impl.StdScheduler.addJob&#40;StdScheduler.java&#58;244&#41;
            at org.springframework.scheduling.quartz.SchedulerFactoryBean.addJobToScheduler&#40;SchedulerFactoryBean.java&#58;524&#41;
            at org.springframework.scheduling.quartz.SchedulerFactoryBean.registerJobsAndTriggers&#40;SchedulerFactoryBean.java&#58;
    486&#41;
            at org.springframework.scheduling.quartz.SchedulerFactoryBean.afterPropertiesSet&#40;SchedulerFactoryBean.java&#58;404&#41;
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods&#40;AbstractAutowi
    reCapableBeanFactory.java&#58;948&#41;
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean&#40;AbstractAutowireCapab
    leBeanFactory.java&#58;284&#41;
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean&#40;AbstractAutowireCapab
    leBeanFactory.java&#58;204&#41;
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;199&#41;
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;136&#41;
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons&#40;DefaultListable
    BeanFactory.java&#58;203&#41;
            at org.springframework.context.support.AbstractApplicationContext.refresh&#40;AbstractApplicationContext.java&#58;279&#41;
            at org.springframework.web.context.support.XmlWebApplicationContext.refresh&#40;XmlWebApplicationContext.java&#58;131&#41;
            at org.springframework.web.context.ContextLoader.createWebApplicationContext&#40;ContextLoader.java&#58;156&#41;
            at org.springframework.web.context.ContextLoader.initWebApplicationContext&#40;ContextLoader.java&#58;97&#41;
            at org.springframework.web.context.ContextLoaderListener.contextInitialized&#40;ContextLoaderListener.java&#58;48&#41;
            at org.apache.catalina.core.StandardContext.listenerStart&#40;StandardContext.java&#58;3276&#41;
            at org.apache.catalina.core.StandardContext.start&#40;StandardContext.java&#58;3618&#41;
            at org.apache.catalina.core.ContainerBase.start&#40;ContainerBase.java&#58;1188&#41;
            at org.apache.catalina.core.StandardHost.start&#40;StandardHost.java&#58;754&#41;
            at org.apache.catalina.core.ContainerBase.start&#40;ContainerBase.java&#58;1188&#41;
            at org.apache.catalina.core.StandardEngine.start&#40;StandardEngine.java&#58;363&#41;
            at org.apache.catalina.core.StandardService.start&#40;StandardService.java&#58;497&#41;
            at org.apache.catalina.core.StandardServer.start&#40;StandardServer.java&#58;2190&#41;
            at org.apache.catalina.startup.Catalina.start&#40;Catalina.java&#58;512&#41;
            at org.apache.catalina.startup.Catalina.execute&#40;Catalina.java&#58;400&#41;
            at org.apache.catalina.startup.Catalina.process&#40;Catalina.java&#58;180&#41;
            at sun.reflect.NativeMethodAccessorImpl.invoke0&#40;Native Method&#41;
            at sun.reflect.NativeMethodAccessorImpl.invoke&#40;NativeMethodAccessorImpl.java&#58;39&#41;
            at sun.reflect.DelegatingMethodAccessorImpl.invoke&#40;DelegatingMethodAccessorImpl.java&#58;25&#41;
            at java.lang.reflect.Method.invoke&#40;Method.java&#58;324&#41;
            at org.apache.catalina.startup.Bootstrap.main&#40;Bootstrap.java&#58;203&#41;
    Finally, my quartz.properties are:

    Code:
    #============================================================================
    # 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.jdbcjobstore.JobStoreTX
    org.quartz.jobStore.class = org.springframework.scheduling.quartz.LocalDataSourceJobStore
    org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
    ##org.quartz.jobStore.useProperties = false
    #org.quartz.jobStore.dataSource = myDS
    ##org.quartz.jobStore.tablePrefix = QRTZ_
    ##org.quartz.jobStore.isClustered = true
    
    #============================================================================
    # Configure Datasources
    #============================================================================
    
    #org.quartz.dataSource.myDS.driver = 
    #org.quartz.dataSource.myDS.URL = 
    #org.quartz.dataSource.myDS.user = 
    #org.quartz.dataSource.myDS.password =
    #org.quartz.dataSource.myDS.maxConnections = 
    #org.quartz.dataSource.myDS.validationQuery=
    
    #============================================================================
    # Configure Plugins
    #============================================================================
    
    ##org.quartz.plugin.shutdownHook.class = org.quartz.plugins.management.ShutdownHookPlugin
    ##org.quartz.plugin.shutdownHook.cleanShutdown = true
    
    
    org.quartz.plugin.triggHistory.class = org.quartz.plugins.history.LoggingJobHistoryPlugin
    Has anyone else run into this problem?

    Any help would be greatly appreciated.

  2. #2
    Join Date
    Sep 2004
    Location
    Portland, OR
    Posts
    54

    Default

    I just realized I forgot to post my config:

    Code:
    <bean name="setupJobDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
            <property name="jobClass">
                <value>com.foo.SetupJob</value>
            </property>
            <property name="jobDataAsMap">
                <map>
                    <entry key="timeout">
                        <value>5</value>
                    </entry>
                </map>
            </property>
        </bean>
    
        <bean id="simpleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
            <property name="jobDetail">
                <!-- see the example of method invoking job above -->
                <ref bean="setupJobDetail"/>
            </property>
            <property name="startDelay">
                <!-- 10 seconds -->
                <value>10000</value>
            </property>
            <property name="repeatInterval">
                <!-- repeat every 50 seconds -->
                <value>50000000000</value>
            </property>
        </bean>
    
        <bean id="schedulerFactory" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
            <property name="dataSource">
                <ref bean="dataSource"/>
            </property>
            <property name="triggers">
                <list>
                    <ref local="simpleTrigger"/>
                </list>
            </property>
        </bean>

  3. #3
    Join Date
    Sep 2004
    Location
    Portland, OR
    Posts
    54

    Default

    If I don't pass any triggers to the SchedulerFactoryBean, it starts up correctly. However, on shutdown, I get this error:

    Code:
    Using context class &#91;org.springframework.web.context.support.XmlWebApplicationContext&#93; for root WebApplicationContext
    Published root WebApplicationContext &#91;org.springframework.web.context.support.XmlWebApplicationContext&#58; displayName=&#91;Root XmlWebApplicationContext&#93;; startup date=&#91;Fri Sep 03 17&#58;45&#58;17 PDT 2004&#93;; root of ApplicationContext hierarchy; config locations=&#91;/WEB-INF/classes/spring-main.xml,/WEB-INF/classes/spring-dao.xml,/WEB-INF/classes/spring-mail.xml,/WEB-INF/classes/spring-rss.xml&#93;; &#93; as ServletContext attribute with name &#91;interface org.springframework.web.context.WebApplicationContext.ROOT&#93;
    Initializing filter 'openSessionInViewFilter'
    Filter 'openSessionInViewFilter' configured successfully
    Closing application context &#91;Root XmlWebApplicationContext&#93;
    Destroying singletons in factory &#123;org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans &#91;sysProps,placeholderConfig,dataSource,sessionFactory,hibernateDAOService,jdbcDAOService,adminDAO,articleDAO,channelDAO,compDAO,execDAO,employeeDAO,extSourceDAO,headlineDAO,mediaDAO,metadataDAO,permissionDAO,tabDAO,topicDAO,userDAO,transactionManager,adminManager,articleManager,channelManager,headlineManager,mediaManager,tabManager,userManager,mailSender,notificationEventListener,notificationTemplate,assignmentNotificationTemplate,submissionNotificationTemplate,articleEventListener,articleFeed,schedulerFactory&#93;; Root of BeanFactory hierarchy&#125;
    Closing Hibernate SessionFactory
    Shutting down Quartz scheduler
    Scheduler QuartzScheduler_$_NON_CLUSTERED shutting down.
    Scheduler QuartzScheduler_$_NON_CLUSTERED paused.
    Database connection shutdown unsuccessful.
    java.sql.SQLException&#58; There is no DataSource named 'dummy'
    	at org.quartz.utils.DBConnectionManager.shutdown&#40;DBConnectionManager.java&#58;147&#41;
    	at org.quartz.impl.jdbcjobstore.JobStoreSupport.shutdown&#40;JobStoreSupport.java&#58;530&#41;
    	at org.quartz.impl.jdbcjobstore.JobStoreCMT.shutdown&#40;JobStoreCMT.java&#58;157&#41;
    	at org.quartz.core.QuartzScheduler.shutdown&#40;QuartzScheduler.java&#58;471&#41;
    	at org.quartz.impl.StdScheduler.shutdown&#40;StdScheduler.java&#58;185&#41;
    	at org.springframework.scheduling.quartz.SchedulerFactoryBean.destroy&#40;SchedulerFactoryBean.java&#58;584&#41;
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.destroyBean&#40;AbstractAutowireCapableBeanFactory.java&#58;1010&#41;
    	at org.springframework.beans.factory.support.AbstractBeanFactory.destroySingleton&#40;AbstractBeanFactory.java&#58;422&#41;
    	at org.springframework.beans.factory.support.AbstractBeanFactory.destroySingletons&#40;AbstractBeanFactory.java&#58;408&#41;
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.destroySingletons&#40;AbstractAutowireCapableBeanFactory.java&#58;973&#41;
    	at org.springframework.context.support.AbstractApplicationContext.close&#40;AbstractApplicationContext.java&#58;414&#41;
    	at org.springframework.web.context.ContextLoader.closeWebApplicationContext&#40;ContextLoader.java&#58;180&#41;
    	at org.springframework.web.context.ContextLoaderListener.contextDestroyed&#40;ContextLoaderListener.java&#58;70&#41;
    	at org.apache.catalina.core.StandardContext.listenerStop&#40;StandardContext.java&#58;3316&#41;
    	at org.apache.catalina.core.StandardContext.stop&#40;StandardContext.java&#58;3682&#41;
    	at org.apache.catalina.core.ContainerBase.removeChild&#40;ContainerBase.java&#58;1036&#41;
    	at org.apache.catalina.core.StandardHostDeployer.remove&#40;StandardHostDeployer.java&#58;470&#41;
    	at org.apache.catalina.core.StandardHost.remove&#40;StandardHost.java&#58;868&#41;
    	at org.apache.catalina.startup.HostConfig.undeployApps&#40;HostConfig.java&#58;758&#41;
    	at org.apache.catalina.startup.HostConfig.stop&#40;HostConfig.java&#58;738&#41;
    	at org.apache.catalina.startup.HostConfig.lifecycleEvent&#40;HostConfig.java&#58;360&#41;
    	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent&#40;LifecycleSupport.java&#58;166&#41;
    	at org.apache.catalina.core.ContainerBase.stop&#40;ContainerBase.java&#58;1221&#41;
    	at org.apache.catalina.core.ContainerBase.stop&#40;ContainerBase.java&#58;1233&#41;
    	at org.apache.catalina.core.StandardService.stop&#40;StandardService.java&#58;554&#41;
    	at org.apache.catalina.core.StandardServer.stop&#40;StandardServer.java&#58;2225&#41;
    	at org.apache.catalina.startup.Catalina$CatalinaShutdownHook.run&#40;Catalina.java&#58;624&#41;
    Database connection shutdown unsuccessful.
    java.sql.SQLException&#58; There is no DataSource named 'dummy'
    	at org.quartz.utils.DBConnectionManager.shutdown&#40;DBConnectionManager.java&#58;147&#41;
    	at org.quartz.impl.jdbcjobstore.JobStoreCMT.shutdown&#40;JobStoreCMT.java&#58;160&#41;
    	at org.quartz.core.QuartzScheduler.shutdown&#40;QuartzScheduler.java&#58;471&#41;
    	at org.quartz.impl.StdScheduler.shutdown&#40;StdScheduler.java&#58;185&#41;
    	at org.springframework.scheduling.quartz.SchedulerFactoryBean.destroy&#40;SchedulerFactoryBean.java&#58;584&#41;
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.destroyBean&#40;AbstractAutowireCapableBeanFactory.java&#58;1010&#41;
    	at org.springframework.beans.factory.support.AbstractBeanFactory.destroySingleton&#40;AbstractBeanFactory.java&#58;422&#41;
    	at org.springframework.beans.factory.support.AbstractBeanFactory.destroySingletons&#40;AbstractBeanFactory.java&#58;408&#41;
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.destroySingletons&#40;AbstractAutowireCapableBeanFactory.java&#58;973&#41;
    	at org.springframework.context.support.AbstractApplicationContext.close&#40;AbstractApplicationContext.java&#58;414&#41;
    	at org.springframework.web.context.ContextLoader.closeWebApplicationContext&#40;ContextLoader.java&#58;180&#41;
    	at org.springframework.web.context.ContextLoaderListener.contextDestroyed&#40;ContextLoaderListener.java&#58;70&#41;
    	at org.apache.catalina.core.StandardContext.listenerStop&#40;StandardContext.java&#58;3316&#41;
    	at org.apache.catalina.core.StandardContext.stop&#40;StandardContext.java&#58;3682&#41;
    	at org.apache.catalina.core.ContainerBase.removeChild&#40;ContainerBase.java&#58;1036&#41;
    	at org.apache.catalina.core.StandardHostDeployer.remove&#40;StandardHostDeployer.java&#58;470&#41;
    	at org.apache.catalina.core.StandardHost.remove&#40;StandardHost.java&#58;868&#41;
    	at org.apache.catalina.startup.HostConfig.undeployApps&#40;HostConfig.java&#58;758&#41;
    	at org.apache.catalina.startup.HostConfig.stop&#40;HostConfig.java&#58;738&#41;
    	at org.apache.catalina.startup.HostConfig.lifecycleEvent&#40;HostConfig.java&#58;360&#41;
    	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent&#40;LifecycleSupport.java&#58;166&#41;
    	at org.apache.catalina.core.ContainerBase.stop&#40;ContainerBase.java&#58;1221&#41;
    	at org.apache.catalina.core.ContainerBase.stop&#40;ContainerBase.java&#58;1233&#41;
    	at org.apache.catalina.core.StandardService.stop&#40;StandardService.java&#58;554&#41;
    	at org.apache.catalina.core.StandardServer.stop&#40;StandardServer.java&#58;2225&#41;
    	at org.apache.catalina.startup.Catalina$CatalinaShutdownHook.run&#40;Catalina.java&#58;624&#41;
    Scheduler QuartzScheduler_$_NON_CLUSTERED shutdown complete.
    Just thought I'd add this into the equation in case it was helpful. I looked through my code and nothing is named "dummy", so it must be a default setting somewhere...

  4. #4
    Join Date
    Aug 2004
    Location
    Montreal - Canada
    Posts
    46

    Default

    Try to add the following property to your
    scheduler configuration.
    Code:
    <prop key="org.quartz.jobStore.selectWithLockSQL">SELECT * FROM &#123;0&#125;LOCKS UPDLOCK WHERE LOCK_NAME = ?</prop>
    Christophe

  5. #5
    Join Date
    Sep 2004
    Location
    Portland, OR
    Posts
    54

    Default

    Thanks croudet! That seems to fix the first problem (so at least I can schedule and run tasks), but the shutdown problem still remains. At least it's progress!

  6. #6
    Join Date
    Aug 2004
    Location
    Montreal - Canada
    Posts
    46

    Default

    I have looked a bit to the Quartz code for the shutdown problem.
    The StdSchedulerFactory.instantiate() method registers DataSource in the DBManager.

    Code:
    dbMgr = DBConnectionManager.getInstance&#40;&#41;;
    dbMgr.addConnectionProvider&#40;dsNames&#91;i&#93;, cp&#41;;
    but the dataSource we passed using <property name="dataSource">...
    is not registered in the dbMgr.
    It seems that only dataSources passed with quartz properties
    (<prop key="org.quartz.dataSource....) are registered.

    I haven't dig enough to see what the shutdown does, but in my case, when the scheduler shuts down, it should not shutdown the dataSource (still in use for DAO). So the current behaviour is fine for me.
    Christophe

  7. #7
    Join Date
    Sep 2004
    Location
    Portland, OR
    Posts
    54

    Default

    I figured out what was causing the fetch out of sequence error. As stated in several places, this is caused when autocommit is set to true and the driver tries to execute a fetch before committing (at least that's what I understand is going on).

    I found the simplest way to deal with this, at least when using the Spring-managed datasource, was to wrap my Quartz scheduling code in a transcation template. Duh! Now the commits are managed correctly by my transactionManager, and all is happy.

    Hope this helps someone in the same bind.

    Sample code is below:

    Code:
    /**
         * Publish out an article event &#40;publish, update, delete&#41;
         *
         * @param action    An action, as defined by constants in NotifyRemoteListenerJob
         * @param articleId
         */
        public void notifyRemoteListeners&#40;final String action, final String articleId, final Date startDate&#41; &#123;
            TransactionTemplate tt = new TransactionTemplate&#40;this.transactionManager&#41;;
            try &#123;
                tt.execute&#40;new TransactionCallbackWithoutResult&#40;&#41; &#123;
                    protected void doInTransactionWithoutResult&#40;TransactionStatus status&#41; &#123;
                        //give job detail a unique name
                        notifyRemoteListenerJobDetail.setName&#40;"notifyRemoteListenerJobDetail&#40;'" + action + "', " + articleId + ", " + new Date&#40;&#41; + "&#41;"&#41;;
    
                        Map jobDataMap = notifyRemoteListenerJobDetail.getJobDataMap&#40;&#41;;
                        jobDataMap.put&#40;"action", action&#41;;
                        jobDataMap.put&#40;"articleId", articleId&#41;;
                        SimpleTrigger trigger =
                                new SimpleTrigger&#40;"articleEventTrigger&#40;'" + action + "', " + articleId + ", " + new Date&#40;&#41; + "&#41;",
                                        Scheduler.DEFAULT_GROUP, startDate&#41;;
                        try &#123;
                            scheduler.scheduleJob&#40;notifyRemoteListenerJobDetail, trigger&#41;;
                        &#125; catch &#40;SchedulerException e&#41; &#123;
                            log.error&#40;"notifyRemoteListeners", e&#41;;
                        &#125;
                    &#125;
                &#125;&#41;;
            &#125; catch &#40;Exception e&#41; &#123;
                log.error&#40;"notifyRemoteListeners", e&#41;;
            &#125;
        &#125;

  8. #8
    Join Date
    Sep 2004
    Location
    China
    Posts
    17

    Default

    hello,dhalbrook

    Can you post the snippet code about the transactionManager from your config file? I come across the same problem with you. I also met with the DataSource named 'dummy' when my scheduler shutdown. I have done as what you suggeted to do, but it didn't work. Can you give me a hand?

    Thanx in advance.

    Yoshiyan

  9. #9
    Join Date
    Sep 2004
    Location
    Portland, OR
    Posts
    54

    Default

    Yoshiyan, I'd love to help you, but I haven't figured out the shutdown problem yet. When I get some more free time I'll have a look through the source code for the SchedulerFactoryBean and hopefully we can get a fix for this into the next build of Spring.

    --Dolan

  10. #10

    Default

    Hi ,

    I need to know where to add:
    <prop key="org.quartz.jobStore.selectWithLockSQL">SELECT * FROM &#123;0&#125;LOCKS UPDLOCK WHERE LOCK_NAME = ?</prop>.

    My qurtz.properties file:


    # Using JobStoreTX
    ## Be sure to run the appropriate script(under docs/dbTables) first to create tables
    org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX


    # Configuring JDBCJobStore with the Table Prefix
    org.quartz.jobStore.tablePrefix = QRTZ_

    # Using DriverDelegate
    org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate

    org.quartz.jobStore.isClustered = true
    org.quartz.jobStore.clusterCheckinInterval = 20000

    #error workaround
    org.quartz.plugin.jobInitializer.class = org.quartz.plugins.xml.JobInitializationPlugin
    #org.quartz.plugin.jobInitializer.fileName = closed-jobs.xml:open-jobs.xml

    #org.quartz.plugin.jobInitializer.overWriteExistin gJobs = false
    #org.quartz.plugin.jobInitializer.failOnFileNotFou nd = true

    org.quartz.scheduler.wrapJobExecutionInUserTransac tion= true
    org.quartz.scheduler.wrapPluginInUserTransaction= true
    # Using datasource
    org.quartz.jobStore.dataSource = fsccDS

    # Define the datasource to use
    org.quartz.dataSource.qzDS.driver = oracle.jdbc.driver.OracleDriver
    org.quartz.dataSource.qzDS.URL = xx
    org.quartz.dataSource.qzDS.user = xxx
    org.quartz.dataSource.qzDS.password = boeing777
    org.quartz.dataSource.qzDS.maxConnections = 30


    -----------------\

    My services.xml file:
    <bean id="emailreporttrigger"
    class="org.springframework.scheduling.quartz.CronT riggerBean">
    <property name="jobDetail">
    <ref bean="emailreportjob" />
    </property>
    <property name="cronExpression">
    <value>0 0 12 1 * ?</value>
    </property>
    </bean>

    <bean id="emailreportjob"
    class="org.springframework.scheduling.quartz.JobDe tailBean">
    <property name="jobClass">
    <value>
    com.ge.oilandgas.dps.fscc.services.EmailReportServ ice
    </value>
    </property>
    <property name="jobDataAsMap">
    <map>
    <entry key="emailNotifierDAO">
    <ref bean="emailnotifierdao" />
    </entry>
    <entry key="mailSender">
    <ref bean="mailsender"/>
    </entry>
    </map>
    </property>
    </bean>

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

    <value>/quartz.properties</value>
    </property>
    <property name="dataSource">
    <ref bean="dataSourceFSCC" />

    </property>
    <property class="org.quartz.jobStore.selectWithLockSQL">
    <value>SELECT * FROM &#123;0&#125;LOCKS UPDLOCK WHERE LOCK_NAME = ?</value>
    </property>
    </bean>




    Problem:::I have the same error as mentioned above:

    Error: org.quartz.impl.jdbcjobstore.LockException: Failure obtaining db row lock: ORA-01002: fetch out of sequence
    [See nested exception: java.sql.SQLException: ORA-01002: fetch out of sequence
    ]
    Caused by:
    x
    [See nested exception: java.sql.SQLException: ORA-01002: fetch out of sequence
    ]


    Please reply fast.

    Thanks,
    Ranjan

Similar Threads

  1. Migrating to new version of Quartz
    By ramkris in forum Container
    Replies: 4
    Last Post: Nov 15th, 2005, 02:51 AM
  2. Quartz question
    By kuns in forum Container
    Replies: 3
    Last Post: Jul 11th, 2005, 03:03 PM
  3. Problem integrating spring with quartz
    By viniciusboson in forum Container
    Replies: 7
    Last Post: Nov 25th, 2004, 04:21 AM
  4. Replies: 1
    Last Post: Nov 10th, 2004, 03:40 AM
  5. Replies: 4
    Last Post: Oct 7th, 2004, 07:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •