Results 1 to 3 of 3

Thread: New to Batch and looking for help...

  1. #1
    Join Date
    Nov 2011
    Location
    Indianapolis, IN
    Posts
    2

    Default New to Batch and looking for help...

    I am new to Spring Batch and of course we are implementing it, typical. Anyway, I believe I have things setup correctly however once I call "jobLauncher.run(jobLocator.getJob(jobName), jobParameters)" nothing happens. From what I can tell we get to this line "JdkDynamicAopProxy.invoke(Object, Method, Object[]) line: 204" and never goes any farther.

    The application is a Spring 2 framework app. I am hoping some one can look at our XML file and see what we are doing wrong. Basically we have a bean called dataManager with a method called createAuditBinder we want to call.

    Thanks,
    Dave

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans" 
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:batch="http://www.springframework.org/schema/batch" 
    	xmlns:p="http://www.springframework.org/schema/p"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans 
                  	http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    		http://www.springframework.org/schema/batch 
    		http://www.springframework.org/schema/batch/spring-batch-2.1.xsd">
    						
    	<bean class="org.springframework.batch.core.scope.StepScope" p:proxyTargetClass="true" />
    	<bean id="jobRepository"
    	    class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean">
    	  <property name="dataSource" ref="grcDataSource"/>	  
    	  <property name="databaseType" value="oracle" />
    	  <property name="transactionManager" ref="transactionManager" /> 
    	  <property name="tablePrefix" value="GRC.BATCH_"	  />
    	</bean>
    	<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>	
    	<bean id="transactionManager"
    	    class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    	  <property name="dataSource" ref="grcDataSource"/>
    	</bean>
                 <bean id="jobExplorer" class="org.springframework.batch.core.explore.support.JobExplorerFactoryBean">
    		<property name="dataSource" ref="grcDataSource"/>
    		<property name="tablePrefix" value="GRC.BATCH_"	  />
    	</bean>
    	<bean id="jobRegistry" class="org.springframework.batch.core.configuration.support.MapJobRegistry" />
    	<bean id="jobRegistryBeanPostProcessor" class="org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor">
    		<property name="jobRegistry" ref="jobRegistry"/>
    	</bean>	
    	<job id="buildAuditBinder" restartable="true" xmlns="http://www.springframework.org/schema/batch">
    		<step id="step1">
    			<tasklet ref="buidTask">
    				<!--  <transaction-attributes propagation="REQUIRED"/> -->
    			</tasklet>
    		</step>
    	</job>
    	<bean id="buidTask"
    		class="org.springframework.batch.core.step.tasklet.MethodInvokingTaskletAdapter">
    		<property name="targetObject" ref="dataManager" />
    		<property name="targetMethod" value="createAuditBinder" />
    	</bean>		
    </beans>

  2. #2
    Join Date
    Nov 2011
    Location
    Indianapolis, IN
    Posts
    2

    Default

    Follow up question, does a POJO need to implement or extend any Spring Batch class in order for it to run? If so, what class and would you have a small example?

    Thanks

  3. #3
    Join Date
    May 2008
    Location
    UK
    Posts
    24

    Default

    You could consider writing a simple integration test to launch your job. I highly recommend the new Spring Batch in Action book which has some examples about this. http://manning.com/templier/

    Look at the JobLauncherTestUtils class for example.

    That is how I test/run our jobs outside of the production environment.
    Last edited by dvb123; Nov 9th, 2011 at 03:58 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
  •