Announcement Announcement Module
Collapse
No announcement yet.
Unable to define job tag in spring batch job.xml Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unable to define job tag in spring batch job.xml

    Hi ,

    I am trying to use conditional flow in specific job xml .Please find the declaration and the error encountered by me

    Code:
    <job id="sampleMyJob">
    		<step name="step1" next="step2"/>
    		<step name="step2"/>
    </job>
    And the following is the exception i am receiving .

    Code:
    Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'job'. One of '{"http://www.springframework.org/schema/beans":import, "http://www.springframework.org/schema/beans":alias, "http://www.springframework.org/schema/beans":bean, WC[##other:"http://www.springframework.org/schema/beans"]}' is expected.
    Please help me out .Thanks in advance
    CVUK

  • #2
    First, you're using spring batch 2.0 right?

    Second, do you have the schema specified in the xml file?:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans:beans 
    	xmlns="http://www.springframework.org/schema/batch" 
    	xmlns:beans="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.0.xsd
    	http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
    
    	<job id="job">
    		...
    	</job>
    </beans:beans>

    Comment


    • #3
      I just realized we don't mention that in the docs, we'll be sure to add it:

      http://jira.springframework.org/browse/BATCH-1062

      Comment


      • #4
        I don't see the xsd document at the url mentioned: http://www.springframework.org/schem...-batch-2.0.xsd. Not sure if this is intentional.

        Comment


        • #5
          Originally posted by stevelaw18 View Post
          I don't see the xsd document at the url mentioned: http://www.springframework.org/schem...-batch-2.0.xsd. Not sure if this is intentional.
          The xsd hasn't been uploaded to that location yet. It will be once 2.0 is released.

          Comment


          • #6
            Hi,

            After specifying the above mentioned schema definition in the xml file , i get the following exception


            Code:
            Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'job'.

            What could be the issue ?


            Regards,
            cvuk

            Comment


            • #7
              The config above worked fine for me. I would make sure that you have the batch schema listed first exactly as shown, otherwise, you will need to add a prefix.

              Code:
              <?xml version="1.0" encoding="UTF-8"?>
              <beans:beans 
              	xmlns="http://www.springframework.org/schema/batch" 
              	xmlns:beans="http://www.springframework.org/schema/beans"
              	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              	xsi:schemaLocation="http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.0.xsd
              	http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
              
              	<job id="job">
              		...
              	</job>
              </beans:beans>

              Comment


              • #8
                Hi,

                I have used exactly the same as mentioned above.

                how did you resolve the xsd unavailability issue .


                Regards,
                cvuk

                Comment


                • #9
                  The spring-batch-2.0.xsd is actually located in the org.springframework.batch.core-2.0.0.M4.jar file. I am using Maven, so I have both the batch-core and batch-infrastructure version 2.0.0.M4 as dependenices.

                  Comment

                  Working...
                  X