Announcement Announcement Module
Collapse
No announcement yet.
Error creating bean with name 'jobRepository' whensqlserver is used fr datarepository Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error creating bean with name 'jobRepository' whensqlserver is used fr datarepository

    Hi ,

    I am new to spring batch . I am trying to use spring batch + ms sql server . My application runs the job and information regarding that job is persisted in databse.

    I have configured jobRepository-dataSource with sqlserver details and jobRepository as:
    <bean id="jobRepository"
    class="org.springframework.batch.core.repository.s upport.JobRepositoryFactoryBean">
    <property name="dataSource" ref="jobRepository-dataSource" />
    <property name="transactionManager" ref="jobRepository-transactionManager"/>
    <property name="databaseType" value="sqlserver" />
    <property name="tablePrefix" value="batch_"/>
    </bean>

    When trying to run a job I am gettign following error :

    ERROR - Job Terminated in error: Error creating bean with name 'jobRepository' defined in class path resource [DB-JobRepository.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: com/thoughtworks/xstream/io/HierarchicalStreamDriver
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'jobRepository' defined in class path resource [DB-JobRepository.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: com/thoughtworks/xstream/io/HierarchicalStreamDriver
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1420)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:519)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 91)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:288 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:190)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:563)
    at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:895)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:425)
    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 org.springframework.batch.core.launch.support.Comm andLineJobRunner.start(CommandLineJobRunner.java:2 82)
    at org.springframework.batch.core.launch.support.Comm andLineJobRunner.main(CommandLineJobRunner.java:57 4)
    Caused by: java.lang.NoClassDefFoundError: com/thoughtworks/xstream/io/HierarchicalStreamDriver
    at org.springframework.batch.core.repository.dao.Jdbc ExecutionContextDao.afterPropertiesSet(JdbcExecuti onContextDao.java:169)
    at org.springframework.batch.core.repository.support. JobRepositoryFactoryBean.createExecutionContextDao (JobRepositoryFactoryBean.java:206)
    at org.springframework.batch.core.repository.support. AbstractJobRepositoryFactoryBean.getTarget(Abstrac tJobRepositoryFactoryBean.java:190)
    at org.springframework.batch.core.repository.support. AbstractJobRepositoryFactoryBean.initializeProxy(A bstractJobRepositoryFactoryBean.java:179)
    at org.springframework.batch.core.repository.support. AbstractJobRepositoryFactoryBean.afterPropertiesSe t(AbstractJobRepositoryFactoryBean.java:186)
    at org.springframework.batch.core.repository.support. JobRepositoryFactoryBean.afterPropertiesSet(JobRep ositoryFactoryBean.java:157)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1477)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1417)
    ... 13 more
    Caused by: java.lang.ClassNotFoundException: com.thoughtworks.xstream.io.HierarchicalStreamDriv er
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 21 more


    Please let me know what this error signifies?
    I tryied googling but couldnt get any solution.

    Thx.

  • #2
    Please use [ code][/code ] tags when you post code/xml/stacktraces...

    Have you actually looked at the stacktrace before posting? The message is quite clear imho... You don't have xstream on your classpath... I suggest using maven/ant+ivy/gradle to manage your dependencies... Saves you a lot of headaches searching for dependend jars/libraries.

    Comment


    • #3
      Thx Sir ..

      I included xstream.jar and jettison.jar which solved the problem

      Comment

      Working...
      X