title: Caused by: java.lang.IllegalStateException: A JobRepository has not been set
body: <p><strong><em>Getting the below Exception:</em></strong></p>
  
  <p>Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobLauncherRead' defined in class path resource [spring-beans.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: A JobRepository has not been set.</p>
  
  <p>Caused by: java.lang.IllegalStateException: A JobRepository has not been set.</p>
  
  <p><strong><em>Code:</em></strong></p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xmlns:tx="http://www.springframework.org/schema/tx"
  xmlns:aop="http://www.springframework.org/schema/aop" 
  xmlns:batch="http://www.springframework.org/schema/batch"
  xsi:schemaLocation="
  http://www.springframework.org/schema/batch
  http://www.springframework.org/schema/batch/spring-batch-2.2.xsd
  http://www.springframework.org/schema/beans
  http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
  http://www.springframework.org/schema/aop 
  http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
  http://www.springframework.org/schema/tx 
  http://www.springframework.org/schema/tx/spring-tx-4.0.xsd"&gt;
  
  &lt;bean
      class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
      &lt;property name="location" value="classpath:Application.properties" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="oracleSessionFactory"
      class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
      &lt;property name="dataSource" ref="oraclesDataSource" /&gt;
      &lt;property name="mappingResources"&gt;
          &lt;list&gt;
              &lt;value&gt;persons.hbm.xml &lt;/value&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  
      &lt;property name="hibernateProperties"&gt;
          &lt;props&gt;
              &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.OracleDialect&lt;/prop&gt;
              &lt;!-- &lt;prop key="hibernate.autocommit"&gt;true&lt;/prop&gt; &lt;prop key="hibernate.connection.isolation"&gt;3&lt;/prop&gt; --&gt;
              &lt;prop key="hibernate.current_session_context_class"&gt;jta&lt;/prop&gt;
              &lt;prop key="hibernate.transaction.factory_class"&gt;
                  org.hibernate.transaction.CMTTransactionFactory
              &lt;/prop&gt;
              &lt;prop key="hibernate.transaction.manager_lookup_class"&gt;
                  com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup
              &lt;/prop&gt;
              &lt;!-- &lt;prop key="hibernate.current_session_context_class"&gt;thread&lt;/prop&gt; --&gt;
              &lt;prop key="hibernate.c3p0.min_size"&gt;5&lt;/prop&gt;
              &lt;prop key="hibernate.c3p0.max_size"&gt;10&lt;/prop&gt;
              &lt;prop key="hibernate.c3p0.timeout"&gt;300&lt;/prop&gt;
          &lt;/props&gt;
      &lt;/property&gt;
  
  &lt;/bean&gt;
  
  &lt;bean id="mysqlSessionFactory"
      class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
      &lt;property name="dataSource" ref="mysqlDataSource" /&gt;
      &lt;property name="mappingResources"&gt;
          &lt;list&gt;
              &lt;value&gt;persons.hbm.xml &lt;/value&gt;
          &lt;/list&gt;
      &lt;/property&gt;
      &lt;property name="hibernateProperties"&gt;
          &lt;props&gt;
              &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/prop&gt;
              &lt;!-- &lt;prop key="hibernate.autocommit"&gt;ture&lt;/prop&gt; &lt;prop key="hibernate.connection.isolation"&gt;3&lt;/prop&gt; --&gt;
              &lt;prop key="hibernate.current_session_context_class"&gt;jta&lt;/prop&gt;
              &lt;prop key="hibernate.transaction.factory_class"&gt;
                  org.hibernate.transaction.CMTTransactionFactory
              &lt;/prop&gt;
              &lt;prop key="hibernate.transaction.manager_lookup_class"&gt;
                  com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup
              &lt;/prop&gt;
  
              &lt;!-- &lt;prop key="hibernate.current_session_context_class"&gt;thread&lt;/prop&gt; --&gt;
              &lt;prop key="hibernate.c3p0.min_size"&gt;5&lt;/prop&gt;
              &lt;prop key="hibernate.c3p0.max_size"&gt;10&lt;/prop&gt;
              &lt;prop key="hibernate.c3p0.timeout"&gt;300&lt;/prop&gt;
          &lt;/props&gt;
      &lt;/property&gt;
  
  &lt;/bean&gt;
  
  
  
  &lt;tx:annotation-driven proxy-target-class="true" /&gt;
  
  &lt;tx:jta-transaction-manager
      transaction-manager="atomikosTransactionManager" /&gt;
  
  &lt;tx:annotation-driven transaction-manager="atomikosTransactionManager"
      proxy-target-class="true" /&gt;
  
  &lt;bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager"
      init-method="init" destroy-method="close"&gt;
      &lt;property name="forceShutdown" value="false" /&gt;
  
  &lt;/bean&gt;
  &lt;bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.J2eeUserTransaction"&gt;
      &lt;property name="transactionTimeout" value="300" /&gt;
  
  &lt;/bean&gt;
  
  
  &lt;tx:annotation-driven /&gt;
  &lt;bean id="transactionManager"
      class="org.springframework.transaction.jta.JtaTransactionManager"
      depends-on="atomikosTransactionManager,atomikosUserTransaction"&gt;
      &lt;property name="transactionManager" ref="atomikosTransactionManager" /&gt;
      &lt;property name="userTransaction" ref="atomikosUserTransaction" /&gt;
      &lt;property name="allowCustomIsolationLevels" value="true" /&gt;
  
  &lt;/bean&gt;
  
  &lt;bean id="mysqlDataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean"
      init-method="init" destroy-method="close"&gt;
      &lt;property name="uniqueResourceName"&gt;
          &lt;value&gt;mySqlDataSource&lt;/value&gt;
      &lt;/property&gt;
      &lt;property name="xaDataSourceClassName"&gt;
          &lt;value&gt;com.mysql.jdbc.jdbc2.optional.MysqlXADataSource&lt;/value&gt;
      &lt;/property&gt;
      &lt;property name="xaProperties"&gt;
          &lt;props&gt;
              &lt;prop key="databaseName"&gt;sys&lt;/prop&gt;
              &lt;prop key="serverName"&gt;localhost&lt;/prop&gt;
              &lt;prop key="port"&gt;3306&lt;/prop&gt;
              &lt;prop key="user"&gt;root&lt;/prop&gt;
              &lt;prop key="password"&gt;magesh123&lt;/prop&gt;
              &lt;prop key="url"&gt;jdbc:mysql://localhost:3306/sys&lt;/prop&gt;
          &lt;/props&gt;
      &lt;/property&gt;
      &lt;property name="minPoolSize"&gt;
          &lt;value&gt;1&lt;/value&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  
  &lt;bean id="oraclesDataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean"
      init-method="init" destroy-method="close"&gt;
      &lt;property name="uniqueResourceName"&gt;
          &lt;value&gt;OracleDataSource&lt;/value&gt;
      &lt;/property&gt;
      &lt;property name="xaDataSourceClassName"&gt;
          &lt;value&gt;oracle.jdbc.xa.client.OracleXADataSource&lt;/value&gt;
      &lt;/property&gt;
      &lt;property name="xaProperties"&gt;
          &lt;props&gt;
              &lt;prop key="databaseName"&gt;XE&lt;/prop&gt;
              &lt;prop key="serverName"&gt;localhost&lt;/prop&gt;
              &lt;!-- &lt;prop key="port"&gt;1521&lt;/prop&gt; --&gt;
              &lt;prop key="user"&gt;system&lt;/prop&gt;
              &lt;prop key="password"&gt;magesh123&lt;/prop&gt;
              &lt;prop key="URL"&gt;jdbc:oracle:thin:@localhost:1521:XE&lt;/prop&gt;
          &lt;/props&gt;
      &lt;/property&gt;
      &lt;property name="minPoolSize"&gt;
          &lt;value&gt;1&lt;/value&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;bean id="persons" class="com.bnym.aal.poc.spring_jta.Persons"&gt;
  &lt;/bean&gt;
  
  &lt;bean id="App" class="com.bnym.aal.poc.spring_jta.App"&gt;
      &lt;property name="springJtaDaoClass" ref="springJtaDaoClass" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="springJtaDaoClass" class="com.bnym.aal.poc.spring_jta.springJtaDaoClass"&gt;
      &lt;property name="oracleSessionFactory" ref="oracleSessionFactory" /&gt;
      &lt;property name="mysqlSessionFactory" ref="mysqlSessionFactory" /&gt;
      &lt;property name="atomikosTransactionManager" ref="transactionManager" /&gt;
      &lt;property name="persons" ref="persons" /&gt;
  
  &lt;/bean&gt;
  
  &lt;bean id="customItemReader" class="com.bnym.aal.poc.spring_jta.customItemReader"&gt;
      &lt;property name="oracleSessionFactory" ref="oracleSessionFactory" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="customItemWriter" class="com.bnym.aal.poc.spring_jta.customItemWriter"&gt;
      &lt;property name="mysqlSessionFactory" ref="mysqlSessionFactory" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="customProcessor" class="com.bnym.aal.poc.spring_jta.customItemProcessor"&gt;
  &lt;/bean&gt;
  
  &lt;batch:job id="jobRead" job-repository="jobRepository"&gt;
      &lt;batch:step id="step1"&gt;
          &lt;batch:tasklet&gt;
              &lt;batch:chunk reader="customItemReader" processor="customProcessor"
                  writer="customItemWriter" commit-interval="5" /&gt;
          &lt;/batch:tasklet&gt;
      &lt;/batch:step&gt;
  &lt;/batch:job&gt;
  
  &lt;bean id="jobRepository"
      class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"&gt;
      &lt;property name="transactionManager" ref="transactionManager" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="jobLauncherRead"
      class="org.springframework.batch.core.launch.support.SimpleJobLauncher"&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p></p>