Announcement Announcement Module
Collapse
No announcement yet.
Problem running partitionJdbcJob Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem running partitionJdbcJob

    Hi all,
    While running partitionJdbcJob i am getting this error


    Error:
    ****************************************
    org.springframework.beans.factory.xml.XmlBeanDefin itionStoreException: Line 29 in XML document from class path resource [jobs/Price-Load-Job.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'job-repository' is not allowed to appear in element 'tasklet'.
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.doLoadBeanDefinitions(XmlBeanDefinitio nReader.java:404)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:342)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:310)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:143)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:178)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:149)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:212)
    at org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:113)
    at org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:80)
    at org.springframework.context.support.AbstractRefres hableApplicationContext.refreshBeanFactory(Abstrac tRefreshableApplicationContext.java:123)
    at org.springframework.context.support.AbstractApplic ationContext.obtainFreshBeanFactory(AbstractApplic ationContext.java:422)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:352)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:139)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:83)
    at za.co.sanlam.epsilon.batch.core.launch.EpsilonJobL auncher.start(EpsilonJobLauncher.java:167)
    at za.co.sanlam.epsilon.batch.core.launch.EpsilonJobL auncher.startJob(EpsilonJobLauncher.java:227)
    ********************************** end ******************


    if i removed job-repository="jobRepository" from the tasklet i got different error


    ****************************Error:**************** ****
    org.springframework.beans.factory.parsing.BeanDefi nitionParsingException: Configuration problem: The 'job-repository' attribute may exist on an <tasklet/> element.
    Offending resource: class path resource [jobs/Price-Load-Job.xml]
    at org.springframework.beans.factory.parsing.FailFast ProblemReporter.error(FailFastProblemReporter.java :68)
    at org.springframework.beans.factory.parsing.ReaderCo ntext.error(ReaderContext.java:85)
    at org.springframework.beans.factory.parsing.ReaderCo ntext.error(ReaderContext.java:72)
    at org.springframework.batch.core.configuration.xml.A bstractStepParser.resolveJobRepositoryRef(Abstract StepParser.java:176)
    at org.springframework.batch.core.configuration.xml.A bstractStepParser.setUpBeanDefinitionForTaskletSte p(AbstractStepParser.java:151)
    at org.springframework.batch.core.configuration.xml.A bstractStepParser.parseTasklet(AbstractStepParser. java:133)
    at org.springframework.batch.core.configuration.xml.A bstractStepParser.parseStep(AbstractStepParser.jav a:85)
    at org.springframework.batch.core.configuration.xml.S tandaloneStepParser.parse(StandaloneStepParser.jav a:40)
    at org.springframework.batch.core.configuration.xml.T opLevelStepParser.parseInternal(TopLevelStepParser .java:39)
    at org.springframework.beans.factory.xml.AbstractBean DefinitionParser.parse(AbstractBeanDefinitionParse r.java:56)
    at org.springframework.beans.factory.xml.NamespaceHan dlerSupport.parse(NamespaceHandlerSupport.java:69)
    at org.springframework.beans.factory.xml.BeanDefiniti onParserDelegate.parseCustomElement(BeanDefinition ParserDelegate.java:1297)
    at org.springframework.beans.factory.xml.BeanDefiniti onParserDelegate.parseCustomElement(BeanDefinition ParserDelegate.java:1287)
    at org.springframework.beans.factory.xml.DefaultBeanD efinitionDocumentReader.parseBeanDefinitions(Defau ltBeanDefinitionDocumentReader.java:135)
    at org.springframework.beans.factory.xml.DefaultBeanD efinitionDocumentReader.registerBeanDefinitions(De faultBeanDefinitionDocumentReader.java:92)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.registerBeanDefinitions(XmlBeanDefinit ionReader.java:507)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.doLoadBeanDefinitions(XmlBeanDefinitio nReader.java:398)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:342)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:310)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:143)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:178)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:149)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:212)
    at org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:113)
    at org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:80)
    at org.springframework.context.support.AbstractRefres hableApplicationContext.refreshBeanFactory(Abstrac tRefreshableApplicationContext.java:123)
    at org.springframework.context.support.AbstractApplic ationContext.obtainFreshBeanFactory(AbstractApplic ationContext.java:422)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:352)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:139)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:83)
    at za.co.sanlam.epsilon.batch.core.launch.EpsilonJobL auncher.start(EpsilonJobLauncher.java:167)
    at za.co.sanlam.epsilon.batch.core.launch.EpsilonJobL auncher.startJob(EpsilonJobLauncher.java:227)
    at za.co.sanlam.epsilon.batch.core.processor.RunJobPr ocessor.process(RunJobProcessor.java:68)
    at za.co.sanlam.epsilon.batch.core.processor.RunJobPr ocessor.process(RunJobProcessor.java:1)
    at org.springframework.batch.core.step.item.SimpleChu nkProcessor.doProcess(SimpleChunkProcessor.java:11 7)
    at org.springframework.batch.core.step.item.SimpleChu nkProcessor.transform(SimpleChunkProcessor.java:21 5)
    at org.springframework.batch.core.step.item.SimpleChu nkProcessor.process(SimpleChunkProcessor.java:182)
    at org.springframework.batch.core.step.item.ChunkOrie ntedTasklet.execute(ChunkOrientedTasklet.java:70)
    at org.springframework.batch.core.step.tasklet.Taskle tStep$2.doInChunkContext(TaskletStep.java:264)
    at org.springframework.batch.core.scope.context.StepC ontextRepeatCallback.doInIteration(StepContextRepe atCallback.java:67)
    at org.springframework.batch.repeat.support.RepeatTem plate.getNextResult(RepeatTemplate.java:352)
    at org.springframework.batch.repeat.support.RepeatTem plate.executeInternal(RepeatTemplate.java:212)
    at org.springframework.batch.repeat.support.RepeatTem plate.iterate(RepeatTemplate.java:143)
    at org.springframework.batch.core.step.tasklet.Taskle tStep.doExecute(TaskletStep.java:239)
    at org.springframework.batch.core.step.AbstractStep.e xecute(AbstractStep.java:197)
    at org.springframework.batch.core.job.AbstractJob.han dleStep(AbstractJob.java:348)
    at org.springframework.batch.core.job.flow.FlowJob.ac cess$100(FlowJob.java:43)
    at org.springframework.batch.core.job.flow.FlowJob$Jo bFlowExecutor.executeStep(FlowJob.java:137)
    at org.springframework.batch.core.job.flow.support.st ate.StepState.handle(StepState.java:60)
    at org.springframework.batch.core.job.flow.support.Si mpleFlow.resume(SimpleFlow.java:144)
    at org.springframework.batch.core.job.flow.support.Si mpleFlow.start(SimpleFlow.java:124)
    at org.springframework.batch.core.job.flow.FlowJob.do Execute(FlowJob.java:105)
    at org.springframework.batch.core.job.AbstractJob.exe cute(AbstractJob.java:250)
    at org.springframework.batch.core.launch.support.Simp leJobLauncher$1.run(SimpleJobLauncher.java:110)

    **************************************************
    Thanks for ur reply in advance

  • #2
    How about posting the XML?

    Comment


    • #3
      Sorry,

      This is my XML:

      <job id="partitionJdbcJob" xmlns="http://www.springframework.org/schema/batch">
      <step id="step">
      <partition step="step1" partitioner="partitioner">
      <handler grid-size="2" task-executor="taskExecutor" />
      </partition>
      </step>
      </job>

      <bean id="partitioner"
      class="org.springframework.batch.sample.common.Col umnRangePartitioner">
      <property name="dataSource" ref="dataSource" />
      <property name="table" value="CUSTOMER" />
      <property name="column" value="ID" />
      </bean>

      <bean id="taskExecutor" class="org.springframework.core.task.SyncTaskExecu tor" />

      <step id="step1" xmlns="http://www.springframework.org/schema/batch">
      <tasklet transaction-manager="transactionManager">
      <chunk reader="pricesLoadReader" processor="pricesLoadProcessor"
      writer="pricesLoadWriter" commit-interval="3">
      </chunk>
      <listeners>
      <listener ref="fileNameListener" />
      </listeners>
      </tasklet>
      </step>



      <!--
      Step:Prices Load Reader : To retrieve the Records from the DaysPrce
      Table and OrderBy Based on StartDate
      -->
      <bean id="pricesLoadReader"
      class="batch.priceload.reader.PriceLoadReader">
      <property name="fundBo">
      <bean class="fund.business.PriceBo">
      <property name="priceLoadDao">
      <bean class="fund.dao.PriceLoadDaoHibernate">
      <property name="sessionFactory" ref="batchSessionFactory" />
      </bean>
      </property>
      </bean>
      </property>
      </bean>


      <!--
      Step:Prices Load Processor : To the Each Record of the Daysprce Table
      the Corresponding data is matched with Prices Table and Validation
      Process is Done
      -->
      <bean id="pricesLoadProcessor"
      class="batch.priceload.processor.PriceLoadProcesso r">
      <property name="fundBo">
      <bean class="fund.business.PriceBo">
      <property name="priceLoadDao">
      <bean class="fund.dao.PriceLoadDaoHibernate">
      <property name="sessionFactory" ref="batchSessionFactory"></property>
      </bean>
      </property>
      </bean>
      </property>
      </bean>

      <!--
      Step:Prices Load Writer : To Update the Record in the Prices Table and
      in the Price History Table
      -->
      <bean id="pricesLoadWriter"
      class="batch.priceload.writer.PriceLoadWriter">
      <property name="fundBo">
      <bean class="fund.business.PriceBo">
      <property name="priceLoadDao">
      <bean class="fund.dao.PriceLoadDaoHibernate">
      <property name="sessionFactory" ref="batchSessionFactory"></property>
      </bean>
      </property>
      </bean>
      </property>
      </bean>
      </beans>

      Comment


      • #4
        The error message is confusing, but I think the problem may just be that you override the transaction manager in your tasklet but nowhere else. What happens if you simply remove the transaction-manager="" attributes?

        Comment


        • #5
          Thanks for your reply.
          if i remove transaction-manager also i got this error
          ********** ***************Error *******************

          org.springframework.beans.factory.parsing.BeanDefi nitionParsingException: Configuration problem: The 'job-repository' attribute may exist on an <tasklet/> element.
          Offending resource: class path resource [jobs/Prices-Load-Job_new.xml]
          at org.springframework.beans.factory.parsing.FailFast ProblemReporter.error(FailFastProblemReporter.java :68)
          at org.springframework.beans.factory.parsing.ReaderCo ntext.error(ReaderContext.java:85)
          at org.springframework.beans.factory.parsing.ReaderCo ntext.error(ReaderContext.java:72)
          at org.springframework.batch.core.configuration.xml.A bstractStepParser.resolveJobRepositoryRef(Abstract StepParser.java:176)
          at org.springframework.batch.core.configuration.xml.A bstractStepParser.setUpBeanDefinitionForTaskletSte p(AbstractStepParser.java:151)
          at org.springframework.batch.core.configuration.xml.A bstractStepParser.parseTasklet(AbstractStepParser. java:133)
          at org.springframework.batch.core.configuration.xml.A bstractStepParser.parseStep(AbstractStepParser.jav a:85)
          at org.springframework.batch.core.configuration.xml.S tandaloneStepParser.parse(StandaloneStepParser.jav a:40)
          at org.springframework.batch.core.configuration.xml.T opLevelStepParser.parseInternal(TopLevelStepParser .java:39)
          at org.springframework.beans.factory.xml.AbstractBean DefinitionParser.parse(AbstractBeanDefinitionParse r.java:56)
          at org.springframework.beans.factory.xml.NamespaceHan dlerSupport.parse(NamespaceHandlerSupport.java:69)
          at org.springframework.beans.factory.xml.BeanDefiniti onParserDelegate.parseCustomElement(BeanDefinition ParserDelegate.java:1297)
          at org.springframework.beans.factory.xml.BeanDefiniti onParserDelegate.parseCustomElement(BeanDefinition ParserDelegate.java:1287)
          at org.springframework.beans.factory.xml.DefaultBeanD efinitionDocumentReader.parseBeanDefinitions(Defau ltBeanDefinitionDocumentReader.java:135)
          at org.springframework.beans.factory.xml.DefaultBeanD efinitionDocumentReader.registerBeanDefinitions(De faultBeanDefinitionDocumentReader.java:92)
          at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.registerBeanDefinitions(XmlBeanDefinit ionReader.java:507)
          at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.doLoadBeanDefinitions(XmlBeanDefinitio nReader.java:398)
          at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:342)
          at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:310)
          at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:143)
          at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:178)
          at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:149)
          at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:212)
          at org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:113)
          at org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:80)
          at org.springframework.context.support.AbstractRefres hableApplicationContext.refreshBeanFactory(Abstrac tRefreshableApplicationContext.java:123)
          at org.springframework.context.support.AbstractApplic ationContext.obtainFreshBeanFactory(AbstractApplic ationContext.java:422)
          at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:352)
          at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:139)
          at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:83)
          at za.co.sanlam.epsilon.batch.core.launch.EpsilonJobL auncher.start(EpsilonJobLauncher.java:167)
          at za.co.sanlam.epsilon.batch.core.launch.EpsilonJobL auncher.startJob(EpsilonJobLauncher.java:227)
          at za.co.sanlam.epsilon.batch.core.initiate.BatchInit iator.main(BatchInitiator.java:46)

          ************************ End ************************

          Comment


          • #6
            I think the problem might be in you custom jobLauncher class EpsilonJobLauncher, if you look in the samples for 2.1.0RC1 you can see as in the config snippet below that the job respository is being set on the job launcher and nowhere else(for the partitions examples at least).

            Code:
            <bean id="jobLauncher"
            		class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
            		<property name="jobRepository" ref="jobRepository" />
            	</bean>
            ...
            
            <bean id="jobRepository"
            		class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean"
            		p:dataSource-ref="dataSource" p:transactionManager-ref="transactionManager" />
            
            ...
            So make sure you set your job repository on the jobLanucher you're using.

            HTH.

            Comment


            • #7
              What version of Spring Batch are you using? Upgrade to 2.1.0.RC1 and try again (I can't see those methods from the stack trace in the current codebase at all).

              Comment

              Working...
              X