2 Replies Latest reply on Mar 2, 2006 4:44 AM by metelka

    How to inject resources from HA-JNDI?

    metelka

      Hi,
      I have a SLSB which sends messages to JMS queue. Everything runs on a cluster, i.e. JMS queue is registered in HA-JNDI and I would like to inject the queue via @Resource to the SLSB:

      1. Is there a way to configure EJB3 contanainer to inject all resources from HA-JNDI instead of local JNDI? Is it a good idea to do it?
      2. If not, is there a way to inject one particular resource from HA-JNDI?
      3. If not, is it ok to remap resources from HA-JNDI to local JNDI and inject them from there? Are there any mbeans available which do this remapping?

      Thanks,
      Petr

        • 1. Re: How to inject resources from HA-JNDI?
          bdecoste

          By "registered in HA-Jndi", I assume you mean that the Queue is in the Global Namespace. You can inject a Queue with the following - note that the mappedName is the Jndi binding in the Global Namespace.

          @Resource(mappedName="queue/testQueue") javax.jms.Queue testQueue;

          • 2. Re: How to inject resources from HA-JNDI?
            metelka

            The problem is that if I use

            @Resource(mappedName="queue/testQueue") javax.jms.Queue testQueue;

            ejb container uses default InitialContext (running on port 1099) to lookup the queue and not ha-jndi context (running on port 1100). Because the queue is registered in global namespace, it is not found and the SLSB cannot be deployed.