使用Spring JMS通过HornetQ ConnectionFactory通过JNDI通过EAR启动EAR的JBoss时出现NameNotFoundException [英] NameNotFoundException when starting JBoss with an EAR using HornetQ ConnectionFactory via JNDI using Spring JMS
问题描述
我正在尝试在Jboss EAP 6.2.4中部署一个具有Spring JMS侦听器,BlazeDS flex和HornetQ的应用程序(EAR).当我部署应用程序并尝试启动服务器时,出现以下异常.
I'm trying to deploy an application (EAR) which has Spring JMS listeners, BlazeDS flex and HornetQ in Jboss EAP 6.2.4. When I deploy the application and try to start the server, I'm getting the below exception.
Caused by: javax.naming.NameNotFoundException: JmsXA -- service jboss.naming.context.java.JmsXA
at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:103)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:197)
at org.jboss.as.naming.InitialContext$DefaultInitialContext.lookup(InitialContext.java:241)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:183)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:179)
at javax.naming.InitialContext.lookup(InitialContext.java:411) [rt.jar:1.7.0_80]
at javax.naming.InitialContext.lookup(InitialContext.java:411) [rt.jar:1.7.0_80]
at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154) [spring-context-3.0.7.RELEASE.jar:3.0.7.RELEASE]
我看到此线程存在类似的问题( https://stackoverflow.com/a/12278834/1326592 ),但是对于我来说,这是行不通的,因为我的应用程序中没有SAR文件.
I saw this thread with similar problem (https://stackoverflow.com/a/12278834/1326592) but this wouldn't work in my case as I dont have a SAR file in my application.
我正在通过jee查找Queues和ConnectionFactory
I'm looking up to the Queues and ConnectionFactory via jee
<jee:jndi-lookup id="connectionFactory" jndi-name="java:/JmsXA"/>
<jee:jndi-lookup id="RequestsQueue" jndi-name="java:/jms/queue/requestQueue"/>
在部署我的应用程序之前,请提出一个有关如何在Jboss中启动HornetQ的解决方案.
Please suggest a solution of how to start the HornetQ in Jboss before deploying my application.
推荐答案
我找到了解决上述问题的方法.
I found a solution for the above issue.
在通过web.xml中的resource-ref引用JNDI之后,此问题得到解决
This got resolved after referring to the JNDI's via resource-ref in web.xml
<resource-ref id="ItftRequestsQueue">
<res-ref-name>requestQueue</res-ref-name>
<res-type>javax.jms.Queue</res-type>
<res-auth>Container</res-auth>
<lookup-name>java:/jms/queue/requestQueue</lookup-name>
</resource-ref>
和 将spring.xml中的resource-ref引用为
and referring to the resource-ref in my spring.xml as
<jee:jndi-lookup id="connectionFactory" jndi-name="connectionFactory"/>
<jee:jndi-lookup id="requestsQueue" jndi-name="requestQueue"/>
这篇关于使用Spring JMS通过HornetQ ConnectionFactory通过JNDI通过EAR启动EAR的JBoss时出现NameNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!