不可能在JBoss 6.1.0中注入JMS QueueConnectionFactory,并附带资源注释 [英] Impossible to inject JMS QueueConnectionFactory in JBoss 6.1.0 with resource annotation
问题描述
我的代码是:
@Resource(name =java:/ QueueConnectionFactory)
private QueueConnectionFactory factory
在jboss6 / server / default / deploy / hornetq / hornetq-jms.xml中有:
< connection-factory name =QueueConnectionFactorysignature =queue>
< xa> true< / xa>
<连接器>
< connector-ref connector-name =in-vm/>
< / connectors>
< entries>
< entry name =java:/ QueueConnectionFactory/>
< / entries>
< / connection-factory>
在部署我的耳机时,我收到此错误:
指定的映射名称/ lookup / jndi-name和任何ResourceProvider都不能处理名为env / java:/ QueueConnectionFactory的类型为javax.jms.QueueConnectionFactory的资源引用
尽管队列工厂在管理控制台中可见,它无法在我的会话bean中注入队列连接工厂。
最后我找到了我的问题的答案:
在 @Resource
注释也需要使用真实的JNDI资源名称的 mappedName
属性。
I was spending a lot time to sort out problem with JBoss 6.1.0 to inject JMS connection factory in my session bean. I am using JBoss 6.1.0 with default profile and running it in debian.
Snip of my code are:
@Resource(name="java:/QueueConnectionFactory")
private QueueConnectionFactory factory
There is in jboss6/server/default/deploy/hornetq/hornetq-jms.xml:
<connection-factory name="QueueConnectionFactory" signature="queue">
<xa>true</xa>
<connectors>
<connector-ref connector-name="in-vm"/>
</connectors>
<entries>
<entry name="java:/QueueConnectionFactory"/>
</entries>
</connection-factory>
While deploying my ear-file I am getting this error:
Neither any mapped-name/lookup/jndi-name specified nor any ResourceProvider could process resource-ref named env/java:/QueueConnectionFactory of type javax.jms.QueueConnectionFactory
It can't inject queue connection factory in my session bean despite of the queue factory being visible in the admin console.
Finally I have found the answer to my question:
In the @Resource
annotation the mappedName
attribute with the real JNDI resource name is required as well.
这篇关于不可能在JBoss 6.1.0中注入JMS QueueConnectionFactory,并附带资源注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!