title: JndiLookupFailureException when spring.batch.initializer.enabled=false
body: <p>Please see <a href="https://stackoverflow.com/questions/39284947/springboot-jndi-datasource-throws-java-lang-classnotfoundexception-org-apache-t">my other question </a> where I added data source information in JNDI of embedded tomcat. </p>
  
  <p>Now I wish to suppress database metadata initialization sql scripts so I add property , <code>spring.batch.initializer.enabled=false</code> in <code>application.properties</code>, please <a href="http://docs.spring.io/spring-boot/docs/current/reference/html/howto-database-initialization.html#howto-initialize-a-spring-batch-database" rel="nofollow noreferrer">see this.</a></p>
  
  <p>When I add this property, I start getting below exception. If I remove this property, all works well. </p>
  
  <p>Not sure what I am missing. </p>
  
  <pre><code>ERROR - 2016-09-05 09:44:46.358; org.springframework.batch.core.step.AbstractStep; Encountered an error executing step step1 in job RCMatcher
  org.springframework.jndi.JndiLookupFailureException: JndiObjectTargetSource failed to obtain new target object; nested exception is javax.naming.NameNotFoundException: Name [java:comp/env/jdbc/RCMatcherDS] is not bound in this Context. Unable to find [java:comp].
      at org.springframework.jndi.JndiObjectTargetSource.getTarget(JndiObjectTargetSource.java:142)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:192)
      at com.sun.proxy.$Proxy37.getConnection(Unknown Source)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
      at com.sun.proxy.$Proxy37.getConnection(Unknown Source)
      at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
      at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:394)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:474)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:484)
      at org.springframework.batch.item.database.JdbcPagingItemReader.doReadPage(JdbcPagingItemReader.java:208)
      at org.springframework.batch.item.database.AbstractPagingItemReader.doRead(AbstractPagingItemReader.java:108)
      at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.read(AbstractItemCountingItemStreamItemReader.java:88)
      at org.springframework.batch.item.support.SynchronizedItemStreamReader.read(SynchronizedItemStreamReader.java:55)
      at org.springframework.batch.core.step.item.SimpleChunkProvider.doRead(SimpleChunkProvider.java:91)
      at org.springframework.batch.core.step.item.SimpleChunkProvider.read(SimpleChunkProvider.java:157)
      at org.springframework.batch.core.step.item.SimpleChunkProvider$1.doInIteration(SimpleChunkProvider.java:116)
      at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:374)
      at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215)
      at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:144)
      at org.springframework.batch.core.step.item.SimpleChunkProvider.provide(SimpleChunkProvider.java:110)
      at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:69)
      at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:406)
      at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:330)
      at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
      at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:271)
      at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:81)
      at org.springframework.batch.repeat.support.TaskExecutorRepeatTemplate$ExecutingRunnable.run(TaskExecutorRepeatTemplate.java:262)
      at org.springframework.core.task.SimpleAsyncTaskExecutor$ConcurrencyThrottlingRunnable.run(SimpleAsyncTaskExecutor.java:268)
      at java.lang.Thread.run(Unknown Source)
  Caused by: javax.naming.NameNotFoundException: Name [java:comp/env/jdbc/RCMatcherDS] is not bound in this Context. Unable to find [java:comp].
      at org.apache.naming.NamingContext.lookup(NamingContext.java:817)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:174)
      at javax.naming.InitialContext.lookup(Unknown Source)
      at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:155)
      at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)
      at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
      at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:179)
      at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
      at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:106)
      at org.springframework.jndi.JndiObjectTargetSource.getTarget(JndiObjectTargetSource.java:135)
      ... 34 more
  </code></pre>