Announcement Announcement Module
No announcement yet.
BeanFactory is null ? Help me plzzzzzz Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • BeanFactory is null ? Help me plzzzzzz

    Hey my benaFactory is null

    public class EmailJob extends QuartzJobBean implements StatefulJob {

    public ApplicationContext applicationContext;

    public void setApplicationContext(ApplicationContext appContext) {
    this.applicationContext = appContext;

    public ApplicationContext getApplicationContext() {
    return applicationContext;

    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {

    SchedulerContext schedulerContext = context.getScheduler().getContext();

    BeanFactory beanFactory = (BeanFactory)schedulerContext.get("applicationCont ext");


    Here is my applicationContext.xml


    <bean id="emailJob" class="org.springframework.scheduling.quartz.JobDe tailBean">
    <property name="jobClass" value="com.graysail.caj.actions.EmailJob"/>
    <property name="businessMgr"><ref bean="businessMgr"/></property>

    <bean id="emailTrigger" class="org.springframework.scheduling.quartz.Simpl eTriggerBean">
    <property name="jobDetail" ref="emailJob"/>
    <property name="repeatInterval" value="30000"/>

    <bean class="org.springframework.scheduling.quartz.Sched ulerFactoryBean">
    <property name="triggers"> <ref bean="emailTrigger" /> </property>
    <property name="applicationContextSchedulerContextKey"><valu e>applicationContext</value></property>



    please can some one tell me why beanFactory is null ?

    am i doing it right


    Rajesh Danala

  • #2
    youe EmailJob bean needs to implement the ApplicationContextAware interface so that the application context knows to inject itself into the EmailJob bean when you request it.