title: Spring batch xmlns xsd schema error
body: <p>I am developing an application using Spring Batch in eclipse</p>
  
  <p>Error I while starting the server is</p>
  
  <pre><code>SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
  org.springframework.beans.factory.BeanCreationException: 
   Error creating bean with name 'notificationController' defined in ServletContext       
   resource [/WEB-INF/springbatch-config.xml]: Cannot create inner bean 
   'com.confluence14.utility.Notifier#72372ef8' of type 
   [com.confluence14.utility.Notifier] while setting constructor argument; 
   nested exception is org.springframework.beans.factory.BeanCreationException: 
   Error creating bean with name 'com.confluence14.utility.Notifier#72372ef8' defined in 
   ServletContext resource [/WEB-INF/springbatch-config.xml]: 
   Cannot resolve reference to 
   bean 'dispatchMailsJob' while setting constructor argument; nested exception is 
   org.springframework.beans.factory.BeanCreationException: Error creating bean with name 
   'dispatchMailsJob': Cannot create inner bean '(inner bean)' of type 
   [org.springframework.batch.core.configuration.xml.SimpleFlowFactoryBean] while setting 
   bean property 'flow'; ......and so on.......
  </code></pre>
  
  <p>My xml file used to config spring batch is</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:batch="http://www.springframework.org/schema/batch" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      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-3.2.xsd
          "&gt;
  
      &lt;batch:job id="dispatchMailsJob" restartable="false" job-repository="jobRepository"&gt;
          &lt;batch:step id="dispatchMailsStep"&gt;
              &lt;batch:tasklet&gt;
                  &lt;batch:chunk reader="mailIdReader" writer="mailWriter" commit-interval="10" /&gt;
              &lt;/batch:tasklet&gt;
          &lt;/batch:step&gt;
      &lt;/batch:job&gt;
  
      &lt;bean id="mailIdReader" class="org.springframework.batch.item.database.JdbcCursorItemReader"&gt;
          &lt;property name="dataSource" ref="myDataSource" /&gt;
          &lt;property name="sql" value="select #{jobParameters['tablename']}.user_id, login_credential.email
                                          from #{jobParameters['tablename']} 
                                          inner join login_credential 
                                          on #{jobParameters['tablename']}.user_id = login_credential.user_id 
                                          where #{jobParameters['tablename']}.#{jobParameters['attribute.name']} = '#{jobParameters['attribute.value']}' 
                                          and #{jobParameters['tablename']}.mapping_type &gt;= '#{jobParameters['mappingType']'};
                                          " /&gt;
          &lt;property name="rowMapper"&gt;
              &lt;bean class="com.confluence14.utility.batch.MailIdRowMapper" /&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="mailWriter" class="com.confluence14.utility.batch.MailWriter"&gt;
          &lt;constructor-arg index="0" ref="mailer" /&gt;
          &lt;constructor-arg index="1" value="#{jobParameters['mail.text']}" /&gt;
          &lt;constructor-arg index="2" value="#{jobParameters['mail.subject']}" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="mailer" class="com.confluence14.utility.Mailer"&gt;
          &lt;constructor-arg index="0" ref="mailSender" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"&gt;
          &lt;property name="host" value="smtp.gmail.com"/&gt;
          &lt;property name="port" value="25"/&gt;
          &lt;property name="username" value="marg.ipicas@gmail.com"/&gt;
          &lt;property name="password" value="todayisTGMC"/&gt;
          &lt;property name="javaMailProperties"&gt;
              &lt;props&gt;
                  &lt;prop key="mail.transport.protocol"&gt;smtp&lt;/prop&gt;
                  &lt;prop key="mail.smtp.auth"&gt;true&lt;/prop&gt;
                  &lt;prop key="mail.smtp.starttls.enable"&gt;true&lt;/prop&gt;
                  &lt;prop key="mail.debug"&gt;true&lt;/prop&gt;
              &lt;/props&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher"&gt;
          &lt;property name="jobRepository" ref="jobRepository" /&gt;
          &lt;property name="taskExecutor" ref="taskExecutor" /&gt;
      &lt;/bean&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="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"&gt;
          &lt;property name="corePoolSize" value="5" /&gt;
          &lt;property name="maxPoolSize" value="5" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="notificationController" class="com.confluence14.controller.NotificationController" &gt;
          &lt;constructor-arg index="0"&gt;
              &lt;bean class="com.confluence14.utility.Notifier" &gt;
                  &lt;constructor-arg index="0" ref="jobLauncher" /&gt;
                  &lt;constructor-arg index="1" ref="dispatchMailsJob" /&gt;
              &lt;/bean&gt;
          &lt;/constructor-arg&gt;
      &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>Now the problem lies in xmlns part at the top of this config file. </p>
  
  <p>In this config file the last bean I declared <code>notificationController</code> tries to refer the bean named <code>dispatchMailsJob</code> which is the first bean declared above but is unable to recognize it. </p>
  
  <p>I am struck on for days. 
  This is my second project in spring batch and I remember that the same issue consumed days in my first project also. (I now don't have access to the code of my first project)</p>
  
  <p>Kindly help me out with what exactly should I write in the xmlns schema part</p>
  
  <p>The spring related libraries I am using are</p>
  
  <pre><code>spring-aop-3.2.3.RELEASE.jar
  spring-batch-core-2.2.3.RELEASE.jar
  spring-batch-infrastructure-2.2.3.RELEASE.jar
  spring-beans-3.2.3.RELEASE.jar
  spring-context-3.2.5.RELEASE.jar
  spring-context-support-3.2.5.RELEASE.jar
  spring-core-3.2.3.RELEASE.jar
  spring-expression-3.2.3.RELEASE.jar
  spring-jdbc-3.2.3.RELEASE.jar
  spring-orm-3.2.3.RELEASE.jar
  spring-retry-1.0.2.RELEASE.jar
  spring-tx-3.2.3.RELEASE.jar
  spring-web-3.2.3.RELEASE.jar
  spring-webmvc-3.2.3.RELEASE.jar
  </code></pre>