0 Replies Latest reply on Oct 31, 2003 8:42 AM by cwele

    Deploying (and finding) reusable EJB in the two ears

    cwele Newbie

      What I have, is one 'reusable' EJB, which can send messages in the some javax.jms.Queue's

      So, in the ejb-jar.xml, I have the folloving entry:
      -------
      <resource-env-ref>
      <resource-env-ref-name>
      jms/ASYNC_SENDER_QUEUE
      </resource-en v-ref-name>

      <resource-env-ref-type>
      javax.jms.Queue
      </resource-env-ref-type>
      </resource-env-ref>
      -------

      - In the first .ear application, I would like to use this EJB to send messages in the queue named

      opcApplication/ORDER_APPROVAL_MDB_QUEUE

      so, in the appropriate jboss.xml I have the folloving mapping:
      -----
      <resource-env-ref>
      <resource-env-ref-name>
      jms/ASYNC_SENDER_QUEUE
      </resource-env-ref-name>
      <jndi-name>
      queue/opcApplication/ORDER_APPROVAL_MDB_QUEUE
      </jndi-name>
      -----

      - In the second .ear application, I would like to use this EJB to send messages in the another queue named

      testQueue

      so, in the appropriate jboss.xml (for that second application) I have the folloving mapping:

      -------
      <resource-env-ref>
      <resource-env-ref-name>
      jms/ASYNC_SENDER_QUEUE
      </resource-env-ref-name>

      <jndi-name>
      queue/testQueue
      </jndi-name>
      </resource-env-ref>
      -------

      -In both cases, content of the ejb-jar.xml is the same.

      -The only way to deploy these ear's is - provide different <local-jndi-name> for these EJB's in appropriates jboss.xml files, correct ?
      (Otherwise I get "name alredy bounds" (or something like that) error)

      -Further, along with ejb, I have some utility classes, whose helps me to find ejb LocalHome reference. In such that class (say, JNDINames.java) I have "hardcoded" values
      for the InitialContex.lookup() parameters, for example:

      public static final String ASYNCSENDER_LOCAL_EJB_HOME=...

      so I can lookup home reference in a usual way:

      ic.lookup(JNDINames.ASYNCSENDER_LOCAL_EJB_HOME);

      But, here is the problem: the same JNDINames.java (with the _same local-jndi-name String values) resides in the both ejb .jar's and thus in the both .ear
      Therefore, one of the lookup() 's cannot find LocalHome reference !

      So, what I should to do to avoid this porblem ?
      Which design (and/or deploying) strategy I must perform ?