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

  • Springbatch with Quartz

    Hi,

    I am trying to configure spring-batch with Quartz scheduler.
    But getting following error.

    Code:
    -------------------------------------------------------------------------------
    Test set: com.intervalintl.enterprise.batch.FromDBBatchTestCase
    -------------------------------------------------------------------------------
    Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 8.875 sec <<< FAILURE!
    testLaunchJob(com.intervalintl.enterprise.batch.FromDBBatchTestCase)  Time elapsed: 8.844 sec  <<< ERROR!
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schedFactoryBean' defined in class path resource [META-INF/EnterpriseServicesWeb/spring/quartz-job-launcher.xml]: Invocation of init method failed; nested exception is org.quartz.JobPersistenceException: Couldn't store job: org.springframework.batch.core.launch.support.SimpleJobLauncher [See nested exception: java.io.NotSerializableException: org.springframework.batch.core.launch.support.SimpleJobLauncher]
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    	at java.security.AccessController.doPrivileged(Native Method)
    org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
    	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
    	at org.springframework.test.AbstractSingleSpringContextTests.createApplicationContext(AbstractSingleSpringContextTests.java:213)
    	at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
    	at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
    org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess
    	at org.quartz.impl.jdbcjobstore.JobStoreCMT.storeJob(JobStoreCMT.java:309)
    	at org.quartz.core.QuartzScheduler.addJob(QuartzScheduler.java:687)
    	at org.quartz.impl.StdScheduler.addJob(StdScheduler.java:261)
    	at org.springframework.scheduling.quartz.SchedulerAccessor.addJobToScheduler(SchedulerAccessor.java:317)
    	at org.springframework.scheduling.quartz.SchedulerAccessor.addTriggerToScheduler(SchedulerAccessor.java:340)
    	at org.springframework.scheduling.quartz.SchedulerAccessor.registerJobsAndTriggers(SchedulerAccessor.java:276)
    	at org.springframework.scheduling.quartz.SchedulerFactoryBean.afterPropertiesSet(SchedulerFactoryBean.java:483)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
    	... 36 more
    My configuration files are as below.

    1) file
    Code:
    <import resource="simple-job-launcher-context.xml" />
    	
    	
    	 <bean id="schedFactoryBean"
              class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
              lazy-init="false">
                <property name="autoStartup" value="true"/>
                <property name="waitForJobsToCompleteOnShutdown" value="true"/>
                <property name="dataSource" ref="dataSource"/>
                <property name="quartzProperties">
                  <props>
                     <!--  local thread --> 
                    <prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop>
    				<prop key="org.quartz.threadPool.threadCount">5</prop>
    				<prop key="org.quartz.threadPool.threadPriority">5</prop>
                    <!--  Job Store   org.quartz.impl.jdbcjobstore.oracle.OracleDelegate -->                
                    <prop key="org.quartz.jobStore.driverDelegateClass">                   
                        org.quartz.impl.jdbcjobstore.StdJDBCDelegate
                    </prop>
                    <prop key="org.quartz.jobStore.class">
                        org.quartz.impl.jdbcjobstore.JobStoreTX
                    </prop>
                    <prop key="org.quartz.jobStore.tablePrefix">QRTZ_</prop>
                    <prop key="org.quartz.dataSource.quartzDS.driver">oracle.jdbc.OracleDriver</prop>
    				<prop key="org.quartz.dataSource.quartzDS.URL">jdbc:oracle:thin:@ken-soradev04.ii-corpnet.com:1526:webd1</prop>
    				<prop key="org.quartz.dataSource.quartzDS.user">SOA_DEV2_USER</prop>
    				<prop key="org.quartz.dataSource.quartzDS.password">SOA_DEV2_USER</prop>                
                    <prop key="org.quartz.dataSource.quartzDS.maxConnections">5</prop>
                    <prop key="org.quartz.jobStore.useProperties">false</prop> 
    				<prop key="org.quartz.jobStore.selectWithLockSQL">SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?</prop>
                 </props>
                 
    				
                </property>
                <property name="triggers">
    		    <list>
    		      <ref bean="xmlJobTrigger"/>		   
    		    </list>
    		  </property>            
        </bean>
        
     <!--
        <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    		  <property name="triggers">
    		    <list>
    		      <ref bean="xmlJobTrigger"/>		   
    		    </list>
    		  </property>  
    	</bean>
        
        -->
        <bean id="xmlJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
    				<property name="jobDetail" ref="jobDetail" />
    				<property name="cronExpression" value="0/10 * * * * ?" />
    			</bean>
    
    	
    	<bean id="jobDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
    		<property name="jobClass" value="org.springframework.batch.sample.quartz.JobLauncherDetails" />
    		<property name="group" value="quartz-batch" />
    		<property name="jobDataAsMap">
    			<map>
    				<entry key="jobName" value="dbJob"/>
    				<entry key="jobLocator" value-ref="jobRegistry"/>
    				<entry key="jobLauncher" value-ref="jobLauncher"/>
    			</map>
    		</property>
    	</bean>
    
    
    	<bean id="jobRegistry" class="org.springframework.batch.core.configuration.support.MapJobRegistry" />
    
    	<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
    		<property name="jobRepository" ref="jobRepository" />
    		<property name="taskExecutor">
    			<bean class="org.springframework.core.task.SimpleAsyncTaskExecutor" />
    		</property>
    	</bean>
    2nd file

    Code:
    	<bean id="jobLauncher"
    		class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
    		<property name="jobRepository" ref="jobRepository" />
    	</bean>
    
    	<bean class="org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor">
    		<property name="jobRegistry" ref="jobRegistry"/>
    	</bean>
    
    	<bean id="jobRepository"
    		class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean"
    		p:dataSource-ref="dataSource" p:transactionManager-ref="transactionManager" />
    
    	<bean id="mapJobRepository"
    		class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"
    		lazy-init="true" autowire-candidate="false" />
    
    	<bean id="jobOperator"
    		class="org.springframework.batch.core.launch.support.SimpleJobOperator"
    		p:jobLauncher-ref="jobLauncher" p:jobExplorer-ref="jobExplorer"
    		p:jobRepository-ref="jobRepository" p:jobRegistry-ref="jobRegistry" />
    
    	<bean id="jobExplorer"
    		class="org.springframework.batch.core.explore.support.JobExplorerFactoryBean"
    		p:dataSource-ref="dataSource" />
    
    	<bean id="jobRegistry"
    		class="org.springframework.batch.core.configuration.support.MapJobRegistry" />
    
    	<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
    		<property name="dataSource" ref="dataSource" />
    	</bean>
    
    	<!--<bean id="logAdvice" class="org.springframework.batch.sample.common.LogAdvice" />
    
    	<bean id="eventAdvice"
    		class="org.springframework.batch.sample.jmx.StepExecutionApplicationEventAdvice" />
    		
    	-->
    	<bean id="appJobExecutionListener" class="com.intervalintl.enterprise.batch.AppJobExecutionListener" />
    My Question :
    1) what is this serialization exception ?
    2) What tables in Database needed for Quartz and Spring-batch.

    Any help will be appreciated.

    Thanks

  • #2
    Springbatch with Quartz

    Shaival,

    Did you find the solution of your problem posted? If so, then please share me the solutions since i too want to implement the same set of functions.

    Regards,
    Parths.

    Comment

    Working...
    X