Startup problems in JBoss EAP 5.2 with HornetQ

Posted on

Hello,

We are running a system in JBoss EAP 5.2, and have used the official patch to replace the JBoss message queue with HornetQ. Our system uses quite a few MDBs, and we've found the system's behavior on startup to be problematic. If there are any messages on any of our queues when we shut down our system, upon startup, we get a barrage of errors from our MDBs trying to receive messages before the connection factory is initialized, and all the messages end up on the DLQ. I have giving an explicit dependency on the connection factory to the MDBs, but this doesn't appear to do anything, and really shouldn't be necessary. Is there some configuration that I've missed that we need to do in order to prevent this error?

The following is a sample stacktrace seen during our startup:

2016-10-10 07:31:06,453 ERROR [org.hornetq.ra.inflow.HornetQMessageHandler] Failed to deliver message
javax.ejb.EJBTransactionRolledbackException: Unable to inject jndi dependency: env//nextMessagesFactory into property .nextMessagesFactory: LocalConnectionFactory not bound
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:115)
at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:194)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.security.RunAsSecurityInterceptorv2.invoke(RunAsSecurityInterceptorv2.java:105)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:79)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.core.context.CurrentInvocationContextInterceptor.invoke(CurrentInvocationContextInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.interceptor.EJB3TCCLInterceptor.invoke(EJB3TCCLInterceptor.java:86)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.mdb.MessagingContainer.localInvoke(MessagingContainer.java:281)
at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.delivery(MessageInflowLocalProxy.java:311)
at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:153)
at com.sun.proxy.$Proxy160.onMessage(Unknown Source)
at org.hornetq.ra.inflow.HornetQMessageHandler.onMessage(HornetQMessageHandler.java:324)
at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:1127)
at org.hornetq.core.client.impl.ClientConsumerImpl.access$500(ClientConsumerImpl.java:56)
at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:1272)
at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:100)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.RuntimeException: Unable to inject jndi dependency: env/org.altarum.syndromica.jms.TheShadow/nextMessagesFactory into property org.altarum.syndromica.jms.TheShadow.nextMessagesFactory: LocalConnectionFactory not bound
at org.jboss.injection.JndiPropertyInjector.lookup(JndiPropertyInjector.java:82)
at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:99)
at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:89)
at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:61)
at org.jboss.ejb3.injection.InjectionHelper.inject(InjectionHelper.java:51)
at org.jboss.ejb3.injection.InjectionHelper.inject(InjectionHelper.java:43)
at org.jboss.ejb3.mdb.MDBInjectionInvocation.proceed(MDBInjectionInvocation.java:45)
at org.jboss.ejb3.injection.InjectionInvocation.invokeTarget(InjectionInvocation.java:97)
at org.jboss.ejb3.injection.InjectionInvocation.invokeNext(InjectionInvocation.java:91)
at org.jboss.ejb3.core.context.CurrentInvocationContextInterceptor.invoke(CurrentInvocationContextInterceptor.java:47)
at org.jboss.ejb3.injection.InjectionInvocation.invokeNext(InjectionInvocation.java:82)
at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
at org.jboss.ejb3.injection.InjectionInvocation.invokeNext(InjectionInvocation.java:82)
at org.jboss.ejb3.EJBContainer.injectBeanContext(EJBContainer.java:1204)
at org.jboss.ejb3.pool.AbstractPool.create(AbstractPool.java:83)
at org.jboss.ejb3.pool.AbstractPool.create(AbstractPool.java:73)
at org.jboss.ejb3.pool.StrictMaxPool.get(StrictMaxPool.java:153)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:58)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
... 26 more
Caused by: javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: LocalConnectionFactory not bound]
at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1399)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:864)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:713)
at sun.reflect.GeneratedMethodAccessor277.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.ejb3.EJBContainer$1.invoke(EJBContainer.java:839)
at com.sun.proxy.$Proxy141.lookup(Unknown Source)
at org.jboss.ejb3.JndiUtil.lookup(JndiUtil.java:44)
at org.jboss.injection.JndiPropertyInjector.lookup(JndiPropertyInjector.java:75)
... 45 more
Caused by: javax.naming.NameNotFoundException: LocalConnectionFactory not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
at org.jnp.server.NamingServer.lookup(NamingServer.java:443)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:753)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:713)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1393)
... 54 more