title: java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.jdbc.JndiDataSourceAutoConfiguration
body: <p>I am trying to write a standalone executable jar (fat jar) . I am using spring boot gradle plugin and writing a SpringBoot App to do this. </p>
  
  <p>Here is my Application.java file</p>
  
  <pre><code>@Configuration
  @EnableAutoConfiguration
  @EnableRabbit
  @EntityScan("persistence.domain")
  @EnableJpaRepositories("persistence.repository")
  @ComponentScan(basePackages = {"common","service"})
  public class Application {
  
       public static void main(final String[] args) {
              final SpringApplicationBuilder appBuilder = new SpringApplicationBuilder(
                  Application.class);
              appBuilder.profiles("common", "common_db").run(args);
            }
  
        @Bean
        @Primary
        @ConfigurationProperties(prefix = "spring.datasource")
        public DataSource primaryDataSource() {
          return DataSourceBuilder.create().build();
        }
  }
  </code></pre>
  
  <p>I have specified properties in yml files. For ex application-common etc . While running Application.java I am getting error :</p>
  
  <pre><code>[2015-09-24 14:40:22.304] boot - 32791  INFO [main] ---AnnotationConfigEmbeddedWebApplicationContext: Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@51a282af: startup date [Thu Sep 24 14:40:22 IST 2015]; root of context hierarchy
  [2015-09-24 14:40:23.194] boot - 32791  WARN [main] --- AnnotationConfigEmbeddedWebApplicationContext: Exception encountered during context initialization - cancelling refresh attempt
  org.springframework.beans.factory.BeanDefinitionStoreException: Failed to load bean class: ; nested exception is java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.jdbc.JndiDataSourceAutoConfiguration
  at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:392)
  at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:165)
  at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:305)
  at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:243)
  at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:254)
  at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:94)
  at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:611)
  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
  at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109)
  at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
  at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
  at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:142)
  at storm.Application.main(Application.java:28)
  Caused by: java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.jdbc.JndiDataSourceAutoConfiguration
  at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:58)
  at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:92)
  at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:190)
  at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:435)
  at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:389)
  ... 12 more
  Caused by: java.lang.NullPointerException
  at org.springframework.boot.autoconfigure.condition.OnPropertyCondition.getMatchOutcome(OnPropertyCondition.java:61)
  at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:45)
  ... 16 more
  </code></pre>
  
  <p>Here is my build.gradle </p>
  
  <pre><code>def projects= [
      ":common",
      ":persistence",
      ":adapter"
  
  ]
  
  buildscript {
  repositories {
    mavenCentral()
    maven { url 'http://repo.spring.io/snapshot' }
    maven { url 'http://repo.spring.io/milestone' }
  }
  dependencies { classpath group: 'org.springframework.boot', name: 'spring-boot-gradle-plugin', version: springBootVersion }
  </code></pre>
  
  <p>}</p>
  
  <pre><code>apply plugin: 'spring-boot'
  apply plugin: 'maven-publish'
  apply from: "${rootDir}/deployTasks.gradle"
  
  springBoot {
  mainClass = "storm.Application"
  }
  
  dependencies {
      compile project(':common')
      compile project(':adapter')
      compile project(':persistence')
      compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator', version: '1.1.8.RELEASE'
      compile group : 'org.springframework.boot',name: 'spring-boot-autoconfigure', version : '1.1.8.RELEASE'
      compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: '1.1.8.RELEASE'
  </code></pre>
  
  <p>}</p>
  
  <p>Database specification as in application-common_db.yml</p>
  
  <pre><code>database:
  host: localhost
  port: 3306
  schema: subscriptions
  username: root
  password: root
  autoconnect:
  maxReconnects: 3
  initialTimeout: 2
  timeout:
  connectTimeout: 0
  socketTimeout: 0
  failover:
  host: localhost 
  port: 3306
  queriesBeforeRetryMaster: 50
  secondsBeforeRetryMaster: 30
  
  
  spring:
  datasource:
  driverClassName: com.mysql.jdbc.Driver
  url: jdbc:mysql://${database.host}:${database.port},${database.failover.host}:${database.failover.port}/${database.schema}?${database.properties}
  username: ${database.username}
  password: ${database.password}
  continueOnError: true
  initialize: false
  initialSize: 0
  timeBetweenEvictionRunsMillis: 5000
  minEvictableIdleTimeMillis: 5000
  removeAbandonedTimeout: 60
  removeAbandoned: true
  minIdle: 0
  </code></pre>
  
  <p>I am not sure how to resolve this error . Can nybody suggest what is going wrong here and why am i getting nullPointerException. </p>
  
  <p>Help is appreciated .</p>
  
  <p>Thanks</p>