3 Replies Latest reply on Jan 8, 2004 1:54 PM by Jeffrey Lam

    MBean depends on EJB

    David Hoots Newbie

      I have a custom MBean that uses an EJB, so I need to tell JBoss to make sure the EJB Deployer is loaded before trying to run my MBean. Here's the MBean entry in my jboss-service.xml file:


      jboss.ejb:service=EJBDeployer
      jboss:service=Naming
      jboss.mq:service=DestinationManager


      When JBoss attempts to create my MBean it fails. The problem I'm having is that JBoss seems to wait for the EJB Deployer to be created, not started, so when my MBean goes to look for the EJB using JNDI it cannot find it. Any way around this?

      Thanks,
      David

        • 1. Re: MBean depends on EJB
          Jon Barnett Master

          Wouldn't it be better to deploy your MBean through the standard JBoss deployer? Look at the user-service.xml. That is the start.

          However, what you probably really want is to package your MBean and the EJB in a SAR with a dependency on the EJB. Your MBean is probably looking for your EJB before it is bound.

          • 2. Re: MBean depends on EJB
            Jason Cunningham Newbie

            you're probably solved this problem by now, but I thought I'd share what worked for me.

            Inside your jboss-service.xml, specify:
            jboss.j2ee:jndiName=JNDI_PATH_OF_YOUR_BEAN],service=EJB

            • 3. Re: MBean depends on EJB
              Jeffrey Lam Newbie

              What if we want to redeploy an EAR file with an updated EJB? I get error messages indicating that my Scheduleable Timer MBean isn't registered after I've redeployed my EAR file. My MBean class is contained in the EAR file, so how do I prevent such error messages (my MBean times out every 10 seconds) ?

              14:21:02,738 ERROR [Scheduler$Listener] Invoke of the Schedulable MBean failed
              javax.management.InstanceNotFoundException: :name=CheckMessageTimer is not registered.
              at org.jboss.mx.server.registry.BasicMBeanRegistry.get(BasicMBeanRegistry.java:354)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:535)
              at org.jboss.varia.scheduler.Scheduler$MBeanListener.handleNotification(Scheduler.java:1354)
              at org.jboss.mx.server.NotificationListenerProxy.handleNotification(NotificationListenerProxy.java:69)
              at javax.management.NotificationBroadcasterSupport.sendNotification(NotificationBroadcasterSupport.java:95)
              at javax.management.timer.Timer.sendNotifications(Timer.java:441)
              at javax.management.timer.Timer.access$000(Timer.java:31)
              at javax.management.timer.Timer$RegisteredNotification.doRun(Timer.java:612)
              at org.jboss.mx.util.SchedulableRunnable.run(SchedulableRunnable.java:164)
              at org.jboss.mx.util.ThreadPool$Worker.run(ThreadPool.java:225)
              14:21:12,738 ERROR [Scheduler$Listener] Invoke of the Schedulable MBean failed
              javax.management.InstanceNotFoundException: :name=CheckMessageTimer is not registered.
              at org.jboss.mx.server.registry.BasicMBeanRegistry.get(BasicMBeanRegistry.java:354)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:535)
              at org.jboss.varia.scheduler.Scheduler$MBeanListener.handleNotification(Scheduler.java:1354)
              at org.jboss.mx.server.NotificationListenerProxy.handleNotification(NotificationListenerProxy.java:69)
              at javax.management.NotificationBroadcasterSupport.sendNotification(NotificationBroadcasterSupport.java:95)
              at javax.management.timer.Timer.sendNotifications(Timer.java:441)
              at javax.management.timer.Timer.access$000(Timer.java:31)
              at javax.management.timer.Timer$RegisteredNotification.doRun(Timer.java:612)
              at org.jboss.mx.util.SchedulableRunnable.run(SchedulableRunnable.java:164)
              at org.jboss.mx.util.ThreadPool$Worker.run(ThreadPool.java:225)