Uploaded image for project: 'EJB 3.0'
  1. EJB 3.0
  2. EJBTHREE-975

HA-JNDI InitialContext for @Resource annotation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • AS 4.2.2.GA
    • AS 4.2.0 GA
    • Clustering
    • None

      We're deploying ejbs in a clustered environment that access JMS topics with @Resource annotation as follows:

      @Resource(mappedName = "TopicConnectionFactory")
      private ConnectionFactory mJmsConnectionFactory;

      @Resource(mappedName = "topic/RoomService/BedStaffUpdate")
      private Topic mStaffUpdateTopic;

      The topics are deployed in deploy-hasingleton and are available to the singleton master in the cluster only. The remaining nodes get the following error:

      javax.naming.NameNotFoundException: topic not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
      at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
      at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
      at javax.naming.InitialContext.lookup(InitialContext.java:351)
      at flex.messaging.services.messaging.adapters.JMSProxy.getDestination(JMSProxy.java:186)
      at flex.messaging.services.messaging.adapters.JMSTopicConsumer.start(JMSTopicConsumer.java:59)
      at flex.messaging.services.messaging.adapters.JMSAdapter.manage(JMSAdapter.java:345)
      at flex.messaging.services.MessageService.manageSubscriptions(MessageService.java:571)
      at flex.messaging.services.MessageService.serviceCommand(MessageService.java:152)
      at flex.messaging.MessageBroker.routeCommandToService(MessageBroker.java:622)
      at flex.messaging.endpoints.AbstractEndpoint.serviceMessage(AbstractEndpoint.java:298)
      at flex.messaging.endpoints.rtmp.AbstractRTMPServer.dispatchMessage(AbstractRTMPServer.java:682)
      at flex.messaging.endpoints.rtmp.NIORTMPConnection$RTMPReader.run(NIORTMPConnection.java:665)
      at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecut
      or.java:643)
      at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.j
      ava:668)
      at java.lang.Thread.run(Thread.java:595)

      See also http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4049784#4049784

      According to Brian Stansberry the @Resource annotations are resolved relative to a default initial context, which will not work for the clustered environment, since we need access to the HA-JNDI context for these. Also according to Brian, getJndiProperties() in DeploymentUnit should be responsible for reading jndi properties defined at deployment through which we might be able to define an HA-JNDI context, but this method returns null in jboss 4.x and also in "2 out of the 3 impls in the AS 5 codebase". See also http://www.jboss.com/index.html?module=bb&op=viewtopic&t=109219

              wdecoste1@redhat.com William Decoste (Inactive)
              almendralcs Ana Holzbach (Inactive)
              Votes:
              3 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: