5 Replies Latest reply on Mar 8, 2004 3:35 AM by stephanenicoll

    MDB and dependencies

    darklord

      I already asked this a couple of weeks ago but got any answer. I am sorry, I can't find the thread anymore (and it was on the mailing list anyway).

      I have two questions about MDB and dependencies:

      # How can you put a dependencies from an MDB instance to a queue. What happens in my situation is the following scenario:

      - ejb-jar A contains an MDB that is connecting to Queue Q
      - ejb-jar B contains a SAR file that declares the Queue Q

      Both A and B are in the same ear. When I deploy the EAR, the MDB inside A is deployed and since the queue does not exist, JBoss outputs a warning and creates a temporary destination. When the sar file of B is deployed, it crashes because the queue already exist. Is there a way to avoid this. Note that moduel A depends on B (that is Session Beans on A have ejb-externa-ref to session beans contained in B). My ejb-jar are modules so I need to keep the declaration of queues inside the module itself (one solution would be to put a SAR at the EAR level but I cannot afford this)

      # How can you put a depedency from an MDB to a particular J2EE component?

      I have an MDB that needs some session bean to process an incoming request on the queue. When Jboss is started and if messages are on this queue, the MDB starts processing them but fails because he got a NameNotFoundExcetion on the session bean home interface. I've put ejb-ref declaration in the deployment descriptor but it does not seem to help.

      Any idea?

      Regards,

      Stephane

        • 1. Re: MDB and dependencies

          In jboss.xml of your mdb

          <jboss>
          <ejb-name>whatever</ejb-name>
          <depends>jmx-name-of-dependency</depends>
          etc.
          


          The jmx-name should be the queue or the other j2ee resource like the
          ejb deployment see jboss.j2ee:service=EjbModule,* or jboss.j2ee:service=EJB,*

          Regards,
          Adrian

          • 2. Re: MDB and dependencies

            Thanks *again* Adrian.
            Your help is very much appreciated.

            Regards,

            Stephane

            • 3. Re: MDB and dependencies

              Damn it! Any clue how I can do this with Xdoclet (except a merge file? :/

              Regards,

              Stephane

              • 4. Re: MDB and dependencies

                I don't see any support in xdoclet for at the ejb level.

                You can add to a container configuration which you can
                specify on your bean and merge into your jboss.xml using a jboss-container.xml

                Regards,
                Adrian

                • 5. Re: MDB and dependencies

                   

                  "adrian@jboss.org" wrote:
                  I don't see any support in xdoclet for <depends> at the ejb level.

                  You can add <depends> to a container configuration which you can
                  specify on your bean and merge into your jboss.xml using a jboss-container.xml

                  Regards,
                  Adrian


                  I've patched xdoclet jboss module this morning. I'll make some tests and if it works I'll submit a patch to the Xdoclet team.

                  Regards,

                  Stephane