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

  • Running examples

    Hi All,

    Just read the reference doc few days ago and today trying to work through the examples.

    Have got them setup in eclipse and build is running ok.

    But when running the examples (multilineJob), I am getting the errors as copied below. I think I am not running them properly. Could someone please provide the command that should be used along with parameters that should be specified.

    I am specifying two command line parameters as "jobs\multilinejob.xml multilineJob". Please help to get me going.

    Regards,


    ----------Error--------
    16:55:20,843 ERROR main CommandLineJobRunner:208 - Job Terminated in error:
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'step1': Cannot resolve reference to bean 'reader' while setting bean property 'itemReader'; nested exception is
    -----------------

  • #2
    How are you kicking them off? By default they work using JUnit. It would also help to see the full stack trace. (Please use code tags)

    Comment


    • #3
      Using commandlinejobrunner

      I am running them using CommandLineJobRunner



      Code:
      18:06:42,109  INFO main ClassPathXmlApplicationContext:411 - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@6025e7: display name [org.springframework.context.support.ClassPathXmlApplicationContext@6025e7]; startup date [Tue Mar 24 18:06:42 GMT 2009]; root of context hierarchy
      18:06:42,187  INFO main XmlBeanDefinitionReader:323 - Loading XML bean definitions from class path resource [jobs/tradeJob.xml]
      18:06:42,359  INFO main DefaultListableBeanFactory:467 - Overriding bean definition for bean 'tradeJob': replacing [Generic bean: class [org.springframework.batch.core.job.flow.support.SimpleFlow]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Generic bean: class [org.springframework.batch.core.job.flow.FlowJob]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
      18:06:42,375  INFO main ClassPathXmlApplicationContext:426 - Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@6025e7]: org.springframework.beans.factory.support.DefaultListableBeanFactory@858bf1
      18:06:42,437  INFO main DefaultListableBeanFactory:414 - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@858bf1: defining beans [org.springframework.batch.core.scope.internalStepScope,step1,step2,step3,tradeJob,validatingProcessor,tradeWriter,customerWriter,creditWriter,tradeSqlItemReader,customerSqlItemReader,tradeDao,customerDao,customerReportItemWriter,fileItemReader,tradeValidator]; root of factory hierarchy
      18:06:42,609  INFO main DefaultListableBeanFactory:421 - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@858bf1: defining beans [org.springframework.batch.core.scope.internalStepScope,step1,step2,step3,tradeJob,validatingProcessor,tradeWriter,customerWriter,creditWriter,tradeSqlItemReader,customerSqlItemReader,tradeDao,customerDao,customerReportItemWriter,fileItemReader,tradeValidator]; root of factory hierarchy
      18:06:42,609 ERROR main CommandLineJobRunner:208 - Job Terminated in error:
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'step1': Cannot resolve reference to bean 'tradeWriter' while setting bean property 'itemWriter'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tradeWriter' defined in class path resource [jobs/tradeJob.xml]: Cannot resolve reference to bean 'tradeDao' while setting bean property 'dao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tradeDao' defined in class path resource [jobs/tradeJob.xml]: Cannot create inner bean 'incrementerParent$child#f9c40' while setting bean property 'incrementer'; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'incrementerParent$child#f9c40' defined in class path resource [jobs/tradeJob.xml]: Could not resolve parent bean definition 'incrementerParent'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'incrementerParent' is defined
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
      	at

      Comment


      • #4
        Many of the examples tie together multiple xml files in the unit test. You'll need to do that if running from the command line. You can use another xml file or imports, either way.

        Comment


        • #5
          example

          Hi,

          Thanks for the response..Can you please provide an example on how to do that?

          I tried specifying the "src/main/resources/jobs/TradeJobFunctionalTests-context.xml", which seems to be importing both files. (Found help on this same forum). but then it is giving me errors as below. Do you think this is a problem of my Eclipse classpath setting? I must admit I am new eclipse as well..Any help will be much appriciated.

          Code:
          18:56:47,109  INFO main ClassPathXmlApplicationContext:411 - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@6025e7: display name [org.springframework.context.support.ClassPathXmlApplicationContext@6025e7]; startup date [Tue Mar 24 18:56:47 GMT 2009]; root of context hierarchy
          18:56:47,187  INFO main XmlBeanDefinitionReader:323 - Loading XML bean definitions from class path resource [src/main/resources/jobs/TradeJobFunctionalTests-context.xml]
          18:56:47,312  INFO main XmlBeanDefinitionReader:323 - Loading XML bean definitions from class path resource [simple-job-launcher-context.xml]
          18:56:47,343  INFO main XmlBeanDefinitionReader:323 - Loading XML bean definitions from class path resource [data-source-context.xml]
          18:56:47,359  INFO main XmlBeanDefinitionReader:323 - Loading XML bean definitions from class path resource [data-source-context-init.xml]
          18:56:47,406  INFO main XmlBeanDefinitionReader:323 - Loading XML bean definitions from class path resource [org/springframework/batch/sample/config/common-context.xml]
          18:56:47,437  INFO main XmlBeanDefinitionReader:323 - Loading XML bean definitions from class path resource [jobs/tradeJob.xml]
          18:56:47,468 ERROR main CommandLineJobRunner:208 - Job Terminated in error:
          org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:/jobs/tradeJob.xml]
          Offending resource: class path resource [src/main/resources/jobs/TradeJobFunctionalTests-context.xml]; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 14 in XML document from class path resource [jobs/tradeJob.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'import'.
          	at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
          	at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
          	at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76)
          	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:182)
          	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:147)
          	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:132)
          	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
          	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
          	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
          	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
          	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
          	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
          	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
          	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
          	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
          	at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)
          	at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:80)
          	at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
          	at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)
          	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
          	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
          	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
          	at org.springframework.batch.core.launch.support.CommandLineJobRunner.start(CommandLineJobRunner.java:189)
          	at org.springframework.batch.core.launch.support.CommandLineJobRunner.main(CommandLineJobRunner.java:251)
          Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 14 in XML document from class path resource [jobs/tradeJob.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'import'.
          	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:404)
          	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
          	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
          	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
          	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
          	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:174)
          	... 20 more

          Comment

          Working...
          X