Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-9424

MDB's are started *BEFORE* EJB's are jndi-bound

    XMLWordPrintable

Details

    Description

      I recently noticed a very strange behaviour (with JBOSS AS 6) with Message-Driven-Beans where we inject EJB.

      If the JMS queue is empty when the jboss server is started, then everything works fine.

      If, no luck, the jms queue is NOT empty, my MDB is apparently mounted BEFORE the ejb's
      and the @Inject failed:
      => "Failure WELD-000079 Could not find the EJB in JNDI: class xxx"

      I further investigated the problem:
      I replaced the @Inject annotation, with a "manual" lookup of my ejb
      using the javax.enterprise.inject.spi.BeanManager capabilities (that i put in a @Postcontruct method of my MDB),
      The trick consisted in trying the lookup n times with a delay of x sec between each attempt.

      Here are the results (excerpt from server.log):

       
      2011-07-28 12:05:06,180 INFO  [STDOUT] (Thread-0 (group:HornetQ-client-global-threads-183899831)) *** [1] Trying to lookup KernelResources
      2011-07-28 12:05:06,190 INFO  [STDOUT] (Thread-0 (group:HornetQ-client-global-threads-183899831)) *** [1] Failure WELD-000079 Could not find the EJB in JNDI:  class net.haulogy.energycomm.kernel.org$jboss$weld$bean-jboss$classloader:id="vfs:$$$Users$bli$Devware$jboss-6$0$0$Dev$server$default$deploy$energycomm-ear$ear"-SessionBean-KernelResources_$$_WeldProxy
      ...
      2011-07-28 12:05:11,191 INFO  [STDOUT] (Thread-0 (group:HornetQ-client-global-threads-183899831)) *** [2] Trying to lookup KernelResources
      2011-07-28 12:05:11,192 INFO  [STDOUT] (Thread-0 (group:HornetQ-client-global-threads-183899831)) *** [2] Failure WELD-000079 Could not find the EJB in JNDI:  class net.haulogy.energycomm.kernel.org$jboss$weld$bean-jboss$classloader:id="vfs:$$$Users$bli$Devware$jboss-6$0$0$Dev$server$default$deploy$energycomm-ear$ear"-SessionBean-KernelResources_$$_WeldProxy
      ...
      2011-07-28 12:05:16,193 INFO  [STDOUT] (Thread-0 (group:HornetQ-client-global-threads-183899831)) *** [3] Trying to lookup KernelResources
      2011-07-28 12:05:16,193 INFO  [STDOUT] (Thread-0 (group:HornetQ-client-global-threads-183899831)) *** [3] Failure WELD-000079 Could not find the EJB in JNDI:  class net.haulogy.energycomm.kernel.org$jboss$weld$bean-jboss$classloader:id="vfs:$$$Users$bli$Devware$jboss-6$0$0$Dev$server$default$deploy$energycomm-ear$ear"-SessionBean-KernelResources_$$_WeldProxy
      ...
      2011-07-28 12:05:21,194 INFO  [STDOUT] (Thread-0 (group:HornetQ-client-global-threads-183899831)) *** [4] Trying to lookup KernelResources
      2011-07-28 12:05:21,194 INFO  [STDOUT] (Thread-0 (group:HornetQ-client-global-threads-183899831)) *** [4] Failure WELD-000079 Could not find the EJB in JNDI:  class net.haulogy.energycomm.kernel.org$jboss$weld$bean-jboss$classloader:id="vfs:$$$Users$bli$Devware$jboss-6$0$0$Dev$server$default$deploy$energycomm-ear$ear"-SessionBean-KernelResources_$$_WeldProxy
      ...
      2011-07-28 12:05:26,195 INFO  [STDOUT] (Thread-0 (group:HornetQ-client-global-threads-183899831)) *** [5] Trying to lookup KernelResources
      2011-07-28 12:05:26,195 INFO  [STDOUT] (Thread-0 (group:HornetQ-client-global-threads-183899831)) *** [5] Failure WELD-000079 Could not find the EJB in JNDI:  class net.haulogy.energycomm.kernel.org$jboss$weld$bean-jboss$classloader:id="vfs:$$$Users$bli$Devware$jboss-6$0$0$Dev$server$default$deploy$energycomm-ear$ear"-SessionBean-KernelResources_$$_WeldProxy
      ...
      2011-07-28 12:05:26,215 INFO  [org.jboss.ejb3.nointerface.impl.jndi.AbstractNoInterfaceViewBinder] (Thread-3) Binding the following entry in Global JNDI for bean:KernelResources
      => finally the EJB is bound !
      
      2011-07-28 12:05:31,196 INFO  [STDOUT] (Thread-0 (group:HornetQ-client-global-threads-183899831)) *** [6] Trying to lookup KernelResources
      2011-07-28 12:05:31,197 INFO  [STDOUT] (Thread-0 (group:HornetQ-client-global-threads-183899831)) *** KernelResources = No-Interface view for endpoint [ jboss.j2ee:ear=energycomm-ear.ear,jar=energycomm-kernel-0.5.0-SNAPSHOT.jar,name=KernelResources,service=EJB3 ]
      => the 6th attempt now works :-)
      

      Conclusion: according to me, there is no doubt: dependencies between MDB's and EJB's are not correctly managed by the app server.
      The app server should wait for all EJB's to be bound before activating the MDB.
      MDB are activated too early (especially when jms queue is not empty at starttime)

      Attachments

        Activity

          People

            Unassigned Unassigned
            bligny@hotmail.com Bernard Ligny Ligny (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: