Search code examples
jbossejbjmsjndijboss5.x

Remote JMS @Resource injection into EJBs


Does anyone know if it is possible to inject a JMS Queue as a @Resource when the jms queue is provided by a remote server.

I'm using Jboss 5.1 with JBoss Messaging. We have a client program on a different JBoss server that needs to post messages to this remote queue.

Thanks in advance.


Solution

  • @Resource annotation has a name attribute in which you can specify the JNDI name of the component you want to inject. The container will however prefix it with java:comp/env, so that means that it will look up resources in your local JNDI namespace.

    You will have to perform a programmatic JNDI lookup for this as far as I know.