2 Replies Latest reply on Jan 3, 2007 4:31 PM by ewade

    ServiveMBean StartUp sequence

    duskodugousko

      Hello,
      i have develop a ServiceMBean wich is using some EJB´s for initializing, and backup data for a application.

      My problem is that jboss starts my Service bevore the EJB´s are deployed and so i become a javax.naming.NameNotFoundException: testBeans not bound.

      When i deploy my Service after jboss has been started, my service works fine.

      Is there a way to say jboss when to start my Service like depend on etc...?
      The service should start after deploying the EJB´s.

        • 1. Re: ServiveMBean StartUp sequence

          I am having a similar problem. Right now I just catch the null pointer exception, log it, and sleep. That seems hokey.

          Is there an event or state somewhere I can test for? Or, I guess specifying the Service bean to start after the EJBs are available would be ok too.

          • 2. Re: ServiveMBean StartUp sequence

            I now have the answer. It took a while to figure this one out as the documentation is a bit thin. You need the @Depends annotation. It can be applied to your MBean class. The syntax is a bit obscure, but it should look something like:

            @Depends({"jboss.j2ee:ear=yourapp.ear,jar=yourapp.jar,name=yourbean,service=EJB3"})