title: How to resolve Spring Batch Error?
body: <p>I am trying to learn Spring batch for writing batch jobs in java. So i am using this <a href="http://www.javabeat.net/2010/09/introduction-to-spring-batch/" rel="nofollow">tutorial</a>.</p>
  
  <p>Now the problem is after I have used all the jars, i started executing the project . This left me with a devious error :</p>
  
  <pre><code>INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1e7b1e7b: defining beans [jobLauncher,jobRepository,transactionManager,wordsFWTasklet,numbersFWTasklet,taskletStep,fileWritingJob]; root of factory hierarchy
  Sep 3, 2013 8:09:29 AM org.springframework.batch.core.launch.support.CommandLineJobRunner start
  
  SEVERE: Job Terminated in error: Error creating bean with name 'fileWritingJob' defined in class path resource [fileWritingJob.xml]: Initialization of bean failed; nested exception is java.lang.NullPointerException
  Throwable occurred: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fileWritingJob' defined in class path resource [fileWritingJob.xml]: Initialization of bean failed; nested exception is java.lang.NullPointerException
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:478)
  
  Caused by: java.lang.NullPointerException
  at org.springframework.core.GenericTypeResolver.getTypeVariableMap(GenericTypeResolver.java:144)
  at org.springframework.core.GenericTypeResolver.resolveReturnType(GenericTypeResolver.java:93)
  </code></pre>
  
  <p>In case, you want to know the code that i have used for my configuration xml, it's below :</p>
  
  <p><strong>fileWritingJob.xml :</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"&gt;
  
      &lt;import resource="applicationContext.xml"/&gt;
  
      &lt;bean id="wordsFWTasklet" class="FileCreatorTasklet"&gt;
          &lt;property name="filePath" value="C:\\temp\\words.txt"/&gt;
          &lt;property name="content" value="abcdefghijklmnopqrstuwxyz"/&gt;
      &lt;/bean&gt;
  
      &lt;bean id="numbersFWTasklet" class="FileCreatorTasklet"&gt;
          &lt;property name="filePath" value="C:\\temp\\numbers.txt"/&gt;
          &lt;property name="content" value="0123456789"/&gt;
      &lt;/bean&gt;
  
      &lt;bean id="taskletStep" abstract="true"
          class="org.springframework.batch.core.step.tasklet.TaskletStep"&gt;
          &lt;property name="jobRepository" ref="jobRepository"/&gt;
      &lt;/bean&gt;
  
      &lt;bean id="fileWritingJob" class="org.springframework.batch.core.job.SimpleJob"&gt;
          &lt;property name="name" value="fileWritingJob" /&gt;
          &lt;property name="steps"&gt;
              &lt;list&gt;
                  &lt;bean parent="taskletStep"&gt;
                      &lt;property name="tasklet" ref="wordsFWTasklet"/&gt;
                      &lt;property name="transactionManager" ref="transactionManager"/&gt;
                  &lt;/bean&gt;
                  &lt;bean parent="taskletStep"&gt;
                      &lt;property name="tasklet" ref="numbersFWTasklet"/&gt;
                      &lt;property name="transactionManager" ref="transactionManager"/&gt;
                  &lt;/bean&gt;
              &lt;/list&gt;
          &lt;/property&gt;
          &lt;property name="jobRepository" ref="jobRepository"/&gt;
      &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p><strong>EDIT :</strong></p>
  
  <p><strong>ApplicationContext.xml :</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.springframework.org/schema/beans 
      http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"&gt;
  
      &lt;bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher"&gt;
          &lt;property name="jobRepository" ref="jobRepository"/&gt;
      &lt;/bean&gt;
  
      &lt;bean id="jobRepository" class="org.springframework.batch.core.repository.support.SimpleJobRepository"&gt;
          &lt;constructor-arg&gt;
              &lt;bean class="org.springframework.batch.core.repository.dao.MapJobInstanceDao"/&gt;
          &lt;/constructor-arg&gt;
          &lt;constructor-arg&gt;
              &lt;bean class="org.springframework.batch.core.repository.dao.MapJobExecutionDao" /&gt;
          &lt;/constructor-arg&gt;
          &lt;constructor-arg&gt;
              &lt;bean class="org.springframework.batch.core.repository.dao.MapStepExecutionDao"/&gt;
          &lt;/constructor-arg&gt;
          &lt;constructor-arg&gt;
              &lt;bean class="org.springframework.batch.core.repository.dao.MapExecutionContextDao"/&gt;
          &lt;/constructor-arg&gt;
      &lt;/bean&gt;
  
      &lt;bean id="transactionManager" class="org.springframework.batch.support.transaction.ResourcelessTransactionManager"/&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>Can any one tell me what am i doing wrong here ?</p>