Announcement Announcement Module
No announcement yet.
wrong xsd? wrong attributes for tasklet Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • wrong xsd? wrong attributes for tasklet

    I just try to migrate from Spring Batch 1.1 to 2.0.0

    When I try to use the property "reader" for the element "tasklet" as in the examples I get an XML-parsing error which says:

    Attribute 'reader' is not allowed to appear in element 'batch:tasklet'

    <beans xmlns="" 
    	<batch:job id="importJob2" parent="simpleJob">
    		<batch:step id="userSummary" parent="simpleStep">
          		<batch:tasklet reader="userSummaryReader" writer="hibernateItemWriter" commit-interval="10" >
    I've got the spring-batch-core-2.0.0.RELEASE.jar in my classpath. When I verify the contained spring-batch-2.0.xsd I cannot find the definition for the attributes reader or writer in it. Am I using the wrong jar or is there really no usage of a reader or writer for the element tasklet?

  • #2
    The "reader" etc attributes were moved to a subelement called <chunk/> to make sure the distinction between a TaskletStep and a chunk-oriented tasklet step was clear:

     <job id="sampleJob">
        <step id="step1">
              <chunk reader="itemReader" writer="itemWriter" commit-interval="10"/>


    • #3
      Thanks for the information!

      But then the doc is not up to date because I found this in 6.3.1:

        <job id="ioSampleJob">
          <step name="step1">
            <tasklet reader="fooReader" processor="compositeProcessor" writer="foobarWriter" commit-interval="2"/>
      and somehow my IDE (Eclipse) still thinks these attributes are for the tasklet element. I wonder where it holds this xsd.
      Last edited by volker; May 5th, 2009, 02:25 PM.


      • #4
        I'll correct that in the docs.


        • #5
          But what if you have a step that is not step oriented? I thought that the whole point of the <tasklet ref="..."> was to avoid having to configure a reader which only returned null?


          • #6
            The ref= attribute is used for referencing a Tasklet (non-chunk-oriented). The <chunk/> element is used for a chunk-oriented step. You must have one or the other, and you can't have both.


            • #7
              But I'm getting a xml validation error when I try to use a ref attribute in a tasklet tag. In fact, I'm totally confused about what the actual spring-batch xsd is. I get one schema if I hit the url I get any entirely different schema (it appears) when I look in the 2.0.0.RC1 jar. It appears that one is used when I run in Eclipse, and another when I run from a command line. In short, I have no idea what the job tag is supposed to look like.


              • #8
                You should be using the 2.0.0.RELEASE jar. A lot has changed since RC1.

                You can check the documentation to see how to use the namespace: