When Jboss scheduler throws InstanceNotFoundException: ayeshaSilvia’s Blog

Standard

The Jboss service was running just fine when triggered from JMX-Console. But when it was run by the scheduler, it was throwing InstanceNotFoundException. I found the solution on StackOverflow,

2014-02-18 00:15:00,002 1097696 ERROR [org.jboss.varia.scheduler.Scheduler$Listener] (Timer-1:) Invoke of the Schedulable MBean failed
javax.management.InstanceNotFoundException: abc.service:name=BlahFile is not registered.
at org.jboss.mx.server.registry.BasicMBeanRegistry.get(BasicMBeanRegistry.java:508)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:638)
at org.jboss.varia.scheduler.Scheduler$MBeanListener.handleNotification(Scheduler.java:1316)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java:138)
at $Proxy10.handleNotification(Unknown Source)
at javax.management.NotificationBroadcasterSupport.handleNotification(NotificationBroadcasterSupport.java:257)
at javax.management.NotificationBroadcasterSupport$SendNotifJob.run(NotificationBroadcasterSupport.java:322)
at javax.management.NotificationBroadcasterSupport$1.execute(NotificationBroadcasterSupport.java:307)
at javax.management.NotificationBroadcasterSupport.sendNotification(NotificationBroadcasterSupport.java:229)
at javax.management.timer.Timer.sendNotification(Timer.java:1237)
at javax.management.timer.Timer.notifyAlarmClock(Timer.java:1206)
at javax.management.timer.TimerAlarmClock.run(Timer.java:1289)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)

Turned out, the jboss-service had following entry:

<mbean code=”aa.bb.cc.dd.BlahFile” name=”abc.service:name=SoBlahFile”>
</mbean>
<!– Data loading to the Touch system is scheduled daily at 02:00 (CET/CEST). –>
<mbean code=”org.jboss.varia.scheduler.Scheduler” name=”abc.scheduled:name=SoBlahFile”>
<attribute name=”StartAtStartup”>false</attribute>
<attribute name=”SchedulableMBean”>abc.service:name=BlahFile</attribute>
<attribute name=”SchedulableMBeanMethod”>startService()</attribute>
<attribute name=”SchedulePeriod”>86400000</attribute>
<attribute name=”InitialRepetitions”>-1</attribute>
<attribute name=”DateFormat”>HH:mm:ss</attribute>
<attribute name=”InitialStartDate”>02:00:00</attribute>
</mbean>

So the culprit was this line:

<attribute name=”SchedulableMBean”>abc.service:name=BlahFile</attribute>

The service name should have been SoBlahFile. So I fixed it and the jboss-service entry was like:

<mbean code=”aa.bb.cc.dd.BlahFile” name=”abc.service:name=SoBlahFile”>
</mbean>
<!– Data loading to the Touch system is scheduled daily at 02:00 (CET/CEST). –>
<mbean code=”org.jboss.varia.scheduler.Scheduler” name=”abc.scheduled:name=SoBlahFile”>
<attribute name=”StartAtStartup”>false</attribute>
<attribute name=”SchedulableMBean”>abc.service:name=SoBlahFile</attribute>
<attribute name=”SchedulableMBeanMethod”>startService()</attribute>
<attribute name=”SchedulePeriod”>86400000</attribute>
<attribute name=”InitialRepetitions”>-1</attribute>
<attribute name=”DateFormat”>HH:mm:ss</attribute>
<attribute name=”InitialStartDate”>02:00:00</attribute>
</mbean>

This fixed my issue. Hope this post saves me time next time! 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s