Note that there are some explanatory texts on larger screens.

plurals
  1. POTest spring batch do nothing
    text
    copied!<p>I'm developing an application with Spring 3. I'm doing some tests with spring batch. This is my job definition:</p> <p>job.xml: </p> <pre><code>&lt;bean id="fabio" class="com.firststepteam.handshake.jobs.PrintTasklet"&gt; &lt;property name="message" value="Fabio"/&gt; &lt;/bean&gt; &lt;bean id="taskletStep" abstract="true" class="org.springframework.batch.core.step.tasklet.TaskletStep"&gt; &lt;property name="jobRepository" ref="jobRepository"/&gt; &lt;property name="transactionManager" ref="txManager"/&gt; &lt;/bean&gt; &lt;bean id="simpleJob" class="org.springframework.batch.core.job.SimpleJob"&gt; &lt;property name="name" value="simpleJob" /&gt; &lt;property name="steps"&gt; &lt;list&gt; &lt;bean parent="taskletStep"&gt; &lt;property name="tasklet" ref="fabio"/&gt; &lt;/bean&gt; &lt;/list&gt; &lt;/property&gt; &lt;property name="jobRepository" ref="jobRepository"/&gt; &lt;/bean&gt; </code></pre> <p></p> <p>This is how i configure batch:</p> <p>batch-context.xml: </p> <pre><code>&lt;bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"&gt; &lt;property name="dataSource" ref="dataSource" /&gt; &lt;/bean&gt; &lt;batch:job-repository id="jobRepository" data-source="dataSource" transaction-manager="txManager" isolation-level-for-create="SERIALIZABLE" table-prefix="BATCH_" max-varchar-length="1000" /&gt; &lt;bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher"&gt; &lt;property name="jobRepository" ref="jobRepository" /&gt; &lt;/bean&gt; </code></pre> <p>The tasklet that i want to run:</p> <pre><code>public class PrintTasklet implements Tasklet{ private String message; public void setMessage(String message) { this.message = message; } public ExitStatus execute() throws Exception { System.out.println("Hello "+message); return ExitStatus.COMPLETED; } </code></pre> <p>This is how i'm trying to run the job:</p> <pre><code>mvn clean compile exec:java -Dexec.mainClass=org.springframework.batch.core.launch.support.CommandLineJobRunner -Dexec.args="job.xml simpleJob" </code></pre> <p>Nothing happens. No exceptions. The job execution is saved in the database in the correct way. But my tasklet is not running. What am I doing wrong here?</p> <p>I'm using maven 2.2.1 on Ubuntu 10.10. Spring Batch version is 2.1.8</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload