[jboss-user] [Beginners Corner] - Schedular MBean & Injection

aslocal do-not-reply at jboss.com
Tue Sep 30 20:10:27 EDT 2008


Hello.  When my Scheduler mBean starts up it can't find my injected EJB's (it works fine from the jmx-console, when I click the method button)  Any ideas?

Code snippet:

   <!-- ==================================================================== -->   <!-- Scheduler Service                                                    -->
  |    <!-- ==================================================================== -->
  |      <!--
  |     | This example shows how to use a target MBean
  | 	-->
  |    <mbean code="org.jboss.mx.timer.JBossTimer"
  |           name="jboss:service=Timer">
  |    </mbean>
  |    
  |    <mbean code="com.craneae.t1.schedular.ejb.jmx.TeamCenterADSchedulerBean"
  |           name=":name=TeamCenterADSchedulerBean">
  |    </mbean>
  |    <mbean code="org.jboss.varia.scheduler.Scheduler"
  |           name=":service=Scheduler,name=TeamCenterADSchedulerBean">
  |       <attribute name="StartAtStartup">true</attribute>
  |       <attribute name="SchedulableMBean">:name=TeamCenterADSchedulerBean</attribute>
  |       <attribute name="SchedulableMBeanMethod">expireAccounts()</attribute>
  |       <attribute name="InitialStartDate">NOW</attribute>
  |       <attribute name="SchedulePeriod">10000</attribute>
  |       <attribute name="InitialRepetitions">1</attribute>
  |       <attribute name="FixedRate">true</attribute>
  |    </mbean> 
  | 
  | 
  | 	//  Inject the UserDAO bean
  | 	@EJB (beanName="UserDAOBean") private UserDAOBeanLocal userDAOBean;
  | 	
  |     //  Update email addresses once per night
  |     @SuppressWarnings("unchecked")
  | 	public void expireAccounts() 
  |     {
  |         List<User> resultList = userDAOBean.getActiveUsers();
  | 

The userDAOBean is always null on startup.

Thanks!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4179676#4179676

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4179676



More information about the jboss-user mailing list