[jboss-user] [Beginners Corner] - Re: Schedular MBean & Injection
aslocal
do-not-reply at jboss.com
Thu Oct 2 19:16:25 EDT 2008
Ok, I found out the problem. I was declaring my mBean as an EJB 3.0 bean, but still implementing a 2.0 class. Therefore, it couldn't get an EJB 3.0 context. I guess I went a little cut and paste happy with Internet examples. Here's what works in case anyone else has this issue:
schedular-service.xml
| <mbean code="org.jboss.varia.scheduler.Scheduler"
| name=":service=Scheduler,scheduable=TeamCenterADSchedulerMBean">
| <attribute name="StartAtStartup">true</attribute>
| <attribute name="SchedulableMBean">name:service=TeamCenterADSchedulerMBean</attribute>
| <attribute name="SchedulableMBeanMethod">expireAccounts()</attribute>
| <attribute name="InitialStartDate">NOW</attribute>
| <attribute name="SchedulePeriod">20000</attribute>
| <attribute name="InitialRepetitions">1</attribute>
| <attribute name="FixedRate">true</attribute>
| <depends>jboss.j2ee:ear=schedular.ear,jar=schedular.jar,name=TeamCenterADSchedulerBean,service=EJB3</depends>
| </mbean>
|
code:
|
| @Service (objectName="name:service=TeamCenterADSchedulerMBean")
| @Management(TeamCenterADScheduler.class)
| public class TeamCenterADSchedulerMBean implements TeamCenterADScheduler
| {
| ...
| }
| public interface TeamCenterADScheduler
| {
|
| public void updateEmail() ;
| public void expireAccounts();
| }
|
It's that easy =) Thanks Peter & Chris from JBoss support on this one.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4180178#4180178
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4180178
More information about the jboss-user
mailing list