简体   繁体   English

查找用于JMS通信的队列的问题:“找不到名为…的资源”

[英]Problems with finding queue for JMS communication: “Can't find a resource named…”

I am writing simple JMS application and I am trying to make message producer class communicate with MDB via queue. 我正在编写简单的JMS应用程序,并且试图使消息生产者类通过队列与MDB通信。 I've added appropriate declaration in standalone-full.xml: 我在standalone-full.xml中添加了适当的声明:

<jms-destinations>
    <jms-queue name="statusQueue">
        <entry name="queue/statusQueue"/>
        <entry name="java:jboss/exported/jms/queue/statusQueue"/>
    </jms-queue>
   .
   .
   .
<jms-destinations>

and this is how I am trying to make connection with the queue in the message producer class 这就是我试图与消息生产者类中的队列建立连接的方式

@ApplicationScoped
public class Notifier {
    @Resource(mappedName = "java:/ConnectionFactory")
    private ConnectionFactory cf;

    @Resource(mappedName = "java:jboss/exported/jms/queue/statusQueue")
    private Queue queueExample;
    .
    .
    .
}

and the error i get: 和我得到的错误:

javax.servlet.ServletException: javax.ejb.EJBException: java.lang.IllegalArgumentException: WFLYWELD0049: Error injecting resource into CDI managed bean. javax.servlet.ServletException:javax.ejb.EJBException:java.lang.IllegalArgumentException:WFLYWELD0049:将资源注入CDI托管bean中时出错。 Can't find a resource named java:jboss/exported/jms/queue/statusQueue defined on private javax.jms.Queue persistance.Notifier.queueExample 找不到在私有javax.jms.Queuepersistance.Notifier.queueExample上定义的名为java:jboss / exported / jms / queue / statusQueue的资源

I've already tried making connection without annotations, using InitialContext but the poblem stayed the same. 我已经尝试过使用InitialContext进行不带注释的连接,但是问题仍然存在。 I am using Wildfly 10.0.10. 我正在使用Wildfly 10.0.10。 Everything seems correct for me, what may be problem? 一切对我来说似乎都是正确的,可能是什么问题?

我通过WildFly管理界面创建了一个队列来解决该问题,该接口可以在http:// localhost:8080 /中输入

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM