title: NullpointerException Dao in bean
body: <p>in my web application developped with GWT, Hibernate ans Spring, I encounter when setting the jobClass bean in the application-context.xml file.</p>
  
  <p>I get a NullPointerException at runtime, with <code>absenceDao</code> being null:</p>
  
  <p>Here is my Java class :</p>
  
  <pre><code>
  public class ExampleJob extends QuartzJobBean {
      private AbsenceDao absenceDao; 
      @Override
      protected void executeInternal(JobExecutionContext context)
      throws JobExecutionException {
          List untreatedDemands = new ArrayList();
          untreatedDemands = absenceDao.getDemandsAskedNotValidated();
      }
      public AbsenceDao getAbsenceDao() {
          return absenceDao;
      }
      public void setAbsenceDao(AbsenceDao absenceDao) {
          this.absenceDao = absenceDao;
      }
  }
  </code></pre>
  
  <p>and here is my application-context.xml :</p>
  
  <p><code>
      
      
          
          
              
                  classpath:internal.properties
              
          
      </p>
  
  <pre><code>&lt;!-- Configuration du crontrigger --&gt;
  &lt;bean id="schedulerFactory" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"&gt;
      &lt;property name="triggers"&gt;
          &lt;list&gt;
              &lt;ref bean="cronTrigger" /&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  &lt;bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"&gt;
      &lt;property name="jobDetail"&gt;
          &lt;ref local="exampleJob1" /&gt;
      &lt;/property&gt;
  
      &lt;property name="cronExpression"&gt;
          &lt;util:constant static-field="fr.web.utils.APP_VAR.CRON_EXPRESSION" /&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;bean id="jobClass" class="fr.web.utils.ExampleJob"&gt;
      &lt;property name="absenceDao" ref="absenceDao"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="exampleJob1" class="org.springframework.scheduling.quartz.JobDetailBean"&gt;
      &lt;property name="jobClass" value="fr.web.utils.ExampleJob" /&gt;
      &lt;property name="jobDataAsMap"&gt;
          &lt;map&gt;
              &lt;entry key="timeout" value="5" /&gt;
          &lt;/map&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;!-- Bean containing all the properties of the application --&gt;
  &lt;bean class="fr.web.utils.ApplicationProperties" id="applicationProperties" lazy-init="true" scope="singleton"&gt;
      &lt;constructor-arg index="0" value="classpath:internal.properties"/&gt;
  &lt;/bean&gt;
  
  &lt;!-- Bean DAO --&gt;
  &lt;bean abstract="true" id="abstractDao"&gt;
      &lt;property name="sessionFactory" ref="sessionFactory"/&gt;
  &lt;/bean&gt;
  &lt;bean class="fr.web.dao.AbsenceDao" id="absenceDao" parent="abstractDao"/&gt;
  
  &lt;/bean&gt;
  </code></pre>
  
  <p>
  </code></p>
  
  <p>I thought setting a property refering the Dao in the jobClass bean was enough, but obviously, I'm wrong.</p>
  
  <p>Edit : if I set the Dao property in the exampleJob1 bean, I get this error at runtime :</p>
  
  <pre><code>
  Error 500 Error creating bean with name 'schedulerFactory' defined in class path resource [application-context.xml]:
  Cannot resolve reference to bean 'cronTrigger' while setting bean property 'triggers' with key [0];
  
  nested exception is org.springframework.beans.factory.BeanCreationException:
  Error creating bean with name 'cronTrigger' defined in class path resource [application-context.xml]:
  Cannot resolve reference to bean 'exampleJob1' while setting bean property 'jobDetail';
  
  nested exception is org.springframework.beans.factory.BeanCreationException:
  Error creating bean with name 'exampleJob1' defined in class path resource [application-context.xml]:
  Error setting property values;
  
  nested exception is org.springframework.beans.NotWritablePropertyException:
  Invalid property 'absenceDao' of bean class [org.springframework.scheduling.quartz.JobDetailBean]:
  Bean property 'absenceDao' is not writable or has an invalid setter method.
  
  Does the parameter type of the setter match the return type of the getter?
  </code></pre>