JBoss - problem with deploying (and finding) reusable EJB in the twoears

S

Svetozar Radojcin

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 ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,016
Latest member
TatianaCha

Latest Threads

Top