Hi all,
I have a simple goal of invoking a session bean on app startup:
<?xml version="1.0" encoding="UTF-8"?> <server> <classpath codebase="." archives="CallCentreWebServiceJAR.jar"/> <mbean code="org.jboss.varia.scheduler.Scheduler" name="CallCentreWeb:service=Scheduler"> <attribute name="StartAtStartup">true</attribute> <attribute name="SchedulableClass">com.hostedtelecom.callcentreweb.util.TimerStart</attribute> <attribute name="InitialStartDate">NOW</attribute> <attribute name="SchedulePeriod">5000</attribute> <attribute name="InitialRepetitions">-1</attribute> <depends>jboss.j2ee:jndiName=ejb/TimerCallCentre,service=EJB</depends> <depends> <mbean code="javax.management.timer.Timer" name="jboss:service=Timer"/> </depends> </mbean> </server>
public class TimerStart implements Schedulable { private static final String JNDI_TIMER= "java:comp/env/ejb/TimerCallCentre"; public void perform(Date now, long remainingRepetitions) { ServiceLocator serviceLocator = ServiceLocator.getInstance(); TimerCallCentreHome timerCallCentreHome = (TimerCallCentreHome) serviceLocator.getEJBHome(JNDI_TIMER,TimerCallCentreHome.class); } }