NameNotFoundException when starting JBoss with an EAR using HornetQ ConnectionFactory via JNDI

冷暖自知 提交于 2019-12-13 17:25:23

问题


I am currently trying to deploy an app on JBoss 6.1 which has some JMS MessageListeners in it. The MessageListeners get the connection factory via JNDI (using Spring), I am using the HornetQ default connection factory which is named ConnectionFactory. I am currently just using the default JMS Queues that JBoss starts with: DLQ and ExpiryQueue

When I deploy via JMX the app has no problem starting.

When I deploy by copying the app in to the deploy directory and start the server the app will fail to start giving the following error message: javax.naming.NameNotFoundException: ConnectionFactory not bound. This implies to me that the app is starting before HornetQ starts and is available via JNDI.

I have looked in to creating dependencies using the jboss-dependency.xml however I have not been able to get this to work and I am not sure if this is even the correct approach.

How can I ensure that the HornetQ starts before my app?


回答1:


I encountered just this problem yesterday, the problem is caused by JBoss starting your application before it has registered the ConnectionFactory and Queues.

I found my application deployed perfectly from Eclipse which waits until after JBoss has started before deploying.

The solution is to modify the server/{node}/deploy/jbossweb.sar/META-INF/jboss-beans.xml file adding the following within the WebServer bean.

<depends>org.hornetq:module=JMS,name="NettyConnectionFactory",type=ConnectionFactory</depends>
<depends>org.hornetq:module=JMS,name="InVMConnectionFactory",type=ConnectionFactory</depends>  
<depends>org.hornetq:module=JMS,name="NettyThroughputConnectionFactory",type=ConnectionFactory</depends>

This worked for me and I found the solution here: http://edemmorny.com/2011/10/17/jboss-as-6-startup-connectionfactory-not-bound/



来源:https://stackoverflow.com/questions/12249491/namenotfoundexception-when-starting-jboss-with-an-ear-using-hornetq-connectionfa

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!