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

  • Problem running CommandLineJobRunner

    Hi,

    Trying to run one of the sample using CommandLineJobRunner. From my MyEclipse 5.0 IDE setting up the CommandLineJobRunner from Menu -> Run -> Run and setting the following -

    Main Tab :
    Project : spring-batch-sample
    Main class : org.springframework.batch.core.launch.support.Comm andLineJobRunner

    Arguments Tab :
    Program Arguments : FootballJobFunctionalTests-context.xml footballJob

    Classpath Tab :
    Folder - spring-batch-samples (default classpath)
    Folder - spring-batch-samples (with all jars under this folder)

    But while trying to do run getting this error -
    Code:
    08:29:45,241  INFO main ClassPathXmlApplicationContext:411 - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@122cdb6: display name [org.springframework.context.support.ClassPathXmlApplicationContext@122cdb6]; startup date [Mon May 11 08:29:45 EDT 2009]; root of context hierarchy
    08:29:45,371  INFO main XmlBeanDefinitionReader:323 - Loading XML bean definitions from class path resource [FootballJobFunctionalTests-context.xml]
    08:29:45,371 ERROR main CommandLineJobRunner:211 - Job Terminated in error:
    org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [FootballJobFunctionalTests-context.xml]; nested exception is java.io.FileNotFoundException: class path resource [FootballJobFunctionalTests-context.xml] cannot be opened because it does not exist
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:349)
    	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:190)
    	at org.springframework.batch.core.launch.support.CommandLineJobRunner.main(CommandLineJobRunner.java:254)
    Caused by: java.io.FileNotFoundException: class path resource [FootballJobFunctionalTests-context.xml] cannot be opened because it does not exist
    	at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:143)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
    	... 14 more
    I am sure I missing something very simple.

    Thanks

  • #2
    You need to provide the path to the application context file:

    Code:
    org/springframework/batch/sample/FootballJobFunctionalTests-context.xml

    Comment


    • #3
      Hi Garrette,

      Thanks for your response. Sorry, didn't follow the part about the application context file. Which xml file do I need to edit with this -

      "org/springframework/batch/sample/FootballJobFunctionalTests-context.xml" value?

      Thanks again.

      Comment


      • #4
        That would be your first program argument. The second program argument would still be "footballJob"

        Comment


        • #5
          Ofcourse! Stupid me. Anyway passed that part of the problem. Now stumbled with this one -
          Code:
          09:45:26,727  INFO main DefaultListableBeanFactory:414 - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1242b11: defining beans [dataSourceInitializer,dataSource,transactionManager,environment,overrideProperties,placeholderProperties,lobHandler,incrementerParent,customEditorConfigurer,jobLauncher,org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor#0,jobRepository,mapJobRepository,jobOperator,jobExplorer,jobRegistry,jdbcTemplate,logAdvice,eventAdvice,org.springframework.batch.core.scope.internalStepScope,org.springframework.beans.factory.config.CustomEditorConfigurer,playerload,gameLoad,playerSummarization,footballJob,summarizationStep,playerWriter,gameWriter,summaryWriter,playerFileItemReader,gameFileItemReader,playerSummarizationSource,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.aop.aspectj.AspectJPointcutAdvisor#0,org.springframework.aop.aspectj.AspectJPointcutAdvisor#1,org.springframework.aop.aspectj.AspectJPointcutAdvisor#2,org.springframework.aop.aspectj.AspectJPointcutAdvisor#3,footballProperties]; root of factory hierarchy
          09:45:32,814  INFO main JobRepositoryFactoryBean:119 - No database type set, using meta data indicating: ORACLE
          09:45:32,885  INFO main DefaultListableBeanFactory:421 - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1242b11: defining beans [dataSourceInitializer,dataSource,transactionManager,environment,overrideProperties,placeholderProperties,lobHandler,incrementerParent,customEditorConfigurer,jobLauncher,org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor#0,jobRepository,mapJobRepository,jobOperator,jobExplorer,jobRegistry,jdbcTemplate,logAdvice,eventAdvice,org.springframework.batch.core.scope.internalStepScope,org.springframework.beans.factory.config.CustomEditorConfigurer,playerload,gameLoad,playerSummarization,footballJob,summarizationStep,playerWriter,gameWriter,summaryWriter,playerFileItemReader,gameFileItemReader,playerSummarizationSource,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.aop.aspectj.AspectJPointcutAdvisor#0,org.springframework.aop.aspectj.AspectJPointcutAdvisor#1,org.springframework.aop.aspectj.AspectJPointcutAdvisor#2,org.springframework.aop.aspectj.AspectJPointcutAdvisor#3,footballProperties]; root of factory hierarchy
          09:45:32,885 ERROR main CommandLineJobRunner:211 - Job Terminated in error:
          org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobLauncher' defined in class path resource [simple-job-launcher-context.xml]: Cannot resolve reference to bean 'jobRepository' while setting bean property 'jobRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobRepository' defined in class path resource [simple-job-launcher-context.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/stream/XMLStreamException
          	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 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
          	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
          	at java.security.AccessController.doPrivileged(Native Method)
          	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
          	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
          	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
          	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
          	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
          	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
          	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
          	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
          	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
          	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:190)
          	at org.springframework.batch.core.launch.support.CommandLineJobRunner.main(CommandLineJobRunner.java:254)
          Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobRepository' defined in class path resource [simple-job-launcher-context.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/stream/XMLStreamException
          	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
          	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
          	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
          	at java.security.AccessController.doPrivileged(Native Method)
          	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
          	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
          	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
          	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
          	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
          	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
          	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
          	... 19 more
          Caused by: java.lang.NoClassDefFoundError: javax/xml/stream/XMLStreamException
          	at org.springframework.batch.core.repository.dao.XStreamExecutionContextStringSerializer.init(XStreamExecutionContextStringSerializer.java:65)
          	at org.springframework.batch.core.repository.dao.XStreamExecutionContextStringSerializer.afterPropertiesSet(XStreamExecutionContextStringSerializer.java:60)
          	at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao.afterPropertiesSet(JdbcExecutionContextDao.java:155)
          	at org.springframework.batch.core.repository.support.JobRepositoryFactoryBean.createExecutionContextDao(JobRepositoryFactoryBean.java:169)
          	at org.springframework.batch.core.repository.support.AbstractJobRepositoryFactoryBean.getTarget(AbstractJobRepositoryFactoryBean.java:139)
          	at org.springframework.batch.core.repository.support.AbstractJobRepositoryFactoryBean.initializeProxy(AbstractJobRepositoryFactoryBean.java:129)
          	at org.springframework.batch.core.repository.support.AbstractJobRepositoryFactoryBean.afterPropertiesSet(AbstractJobRepositoryFactoryBean.java:135)
          	at org.springframework.batch.core.repository.support.JobRepositoryFactoryBean.afterPropertiesSet(JobRepositoryFactoryBean.java:126)
          	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
          	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
          	... 29 more
          Sorry for keep bugging

          Comment


          • #6
            Since it's telling you that the class isn't found, you should make sure that you've included the correct jar in your classpath.

            Comment


            • #7
              Though I think I have all the jars in my classpath I'll check again. By the way would this message have anything to do with the problem?
              Code:
              10:07:55,181  INFO main PropertyOverrideConfigurer:178 - Loading properties file from class path resource [batch-oracle.properties]
              10:07:55,481  INFO main ClassPathXmlApplicationContext:1196 - Bean '(inner bean)' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
              10:07:55,831  INFO main ClassPathXmlApplicationContext:1196 - Bean 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#0' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
              10:07:55,851  INFO main ClassPathXmlApplicationContext:1196 - Bean '(inner bean)#2' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
              10:07:55,851  INFO main ClassPathXmlApplicationContext:1196 - Bean 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#1' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
              10:07:55,851  INFO main ClassPathXmlApplicationContext:1196 - Bean '(inner bean)#4' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
              10:07:55,861  INFO main ClassPathXmlApplicationContext:1196 - Bean 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#2' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
              10:07:55,891  INFO main ClassPathXmlApplicationContext:1196 - Bean '(inner bean)#6' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
              10:07:55,891  INFO main ClassPathXmlApplicationContext:1196 - Bean 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#3' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
              10:07:55,911  INFO main ClassPathXmlApplicationContext:1196 - Bean 'jobRegistry' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
              10:07:56,012  INFO main DefaultListableBeanFactory:414 - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1878144: defining beans [dataSourceInitializer,dataSource,transactionManager,environment,overrideProperties,placeholderProperties,lobHandler,incrementerParent,customEditorConfigurer,jobLauncher,org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor#0,jobRepository,mapJobRepository,jobOperator,jobExplorer,jobRegistry,jdbcTemplate,logAdvice,eventAdvice,org.springframework.batch.core.scope.internalStepScope,org.springframework.beans.factory.config.CustomEditorConfigurer,playerload,gameLoad,playerSummarization,footballJob,summarizationStep,playerWriter,gameWriter,summaryWriter,playerFileItemReader,gameFileItemReader,playerSummarizationSource,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.aop.aspectj.AspectJPointcutAdvisor#0,org.springframework.aop.aspectj.AspectJPointcutAdvisor#1,org.springframework.aop.aspectj.AspectJPointcutAdvisor#2,org.springframework.aop.aspectj.AspectJPointcutAdvisor#3,footballProperties]; root of factory hierarchy
              10:08:00,167  INFO main JobRepositoryFactoryBean:119 - No database type set, using meta data indicating: ORACLE
              10:08:00,247  INFO main DefaultListableBeanFactory:421 - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1878144: defining beans [dataSourceInitializer,dataSource,transactionManager,environment,overrideProperties,placeholderProperties,lobHandler,incrementerParent,customEditorConfigurer,jobLauncher,org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor#0,jobRepository,mapJobRepository,jobOperator,jobExplorer,jobRegistry,jdbcTemplate,logAdvice,eventAdvice,org.springframework.batch.core.scope.internalStepScope,org.springframework.beans.factory.config.CustomEditorConfigurer,playerload,gameLoad,playerSummarization,footballJob,summarizationStep,playerWriter,gameWriter,summaryWriter,playerFileItemReader,gameFileItemReader,playerSummarizationSource,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.aop.aspectj.AspectJPointcutAdvisor#0,org.springframework.aop.aspectj.AspectJPointcutAdvisor#1,org.springframework.aop.aspectj.AspectJPointcutAdvisor#2,org.springframework.aop.aspectj.AspectJPointcutAdvisor#3,footballProperties]; root of factory hierarchy
              10:08:00,257 ERROR main CommandLineJobRunner:211 - Job Terminated in error:

              Comment


              • #8
                Atleast resolved the problem getting the message -
                Code:
                09:45:32,885 ERROR main CommandLineJobRunner:211 - Job Terminated in error:
                org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobLauncher' defined in class path resource [simple-job-launcher-context.xml]: Cannot resolve reference to bean 'jobRepository' while setting bean property 'jobRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobRepository' defined in class path resource [simple-job-launcher-context.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/stream/XMLStreamException
                	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
                Had to separately download stax-api-1.0-2.jar file and add to the library as it was not in the org.springframework.batch-2.0.0.RELEASE-with-dependencies.zip download file.

                Thanks

                Comment


                • #9
                  It looks like you don't have Stax on your classpath.

                  Comment

                  Working...
                  X