【问题标题】:User definition with JMS 2.0 Automatic Resource Definition使用 JMS 2.0 自动资源定义的用户定义
【发布时间】:2016-08-14 04:18:58
【问题描述】:

我正在尝试使用 JMS 2.0 自动资源定义功能。这是生产者中的资源定义:

@JMSConnectionFactoryDefinition(
        name = "java:global/jms/MyConnectionFactory",
        user = "guest",
        maxPoolSize = 30,
        minPoolSize = 20,
        properties = {
                "addressList=mq://localhost:7676",
                "reconnectEnabled=true",
                ""
        }
)
@JMSDestinationDefinition(
        name = "java:global/jms/DemoQueue",
        interfaceName = "javax.jms.Queue",
        destinationName = "demoQueue"
)
...
    @Resource(mappedName = "java:global/jms/DemoQueue")
    private Queue defaultQueue;

    @Inject
    @JMSConnectionFactory("java:global/jms/MyConnectionFactory")
    JMSContext context;

在消费者中:

@Resource(mappedName = "java:global/jms/DemoQueue")
private Queue defaultQueue;

@Inject
@JMSConnectionFactory("java:global/jms/MyConnectionFactory")
JMSContext context;

我收到以前配置的错误:

原因:HornetQSecurityException[errorType=SECURITY_EXCEPTION message=HQ119031: 无法验证用户:null] ... 166 更多

java.lang.RuntimeException: javax.jms.JMSSecurityRuntimeException: HQ119031:无法验证用户:null

如何使用注释解决它?

【问题讨论】:

  • Alexandr,@DJ-MERKEL 回答有帮助吗?如果是这样,您应该将其标记为正确答案

标签: java jms wildfly-8 hornetq


【解决方案1】:

我认为使用注释是不够的。 似乎您的安全域没有在您的 hornetq 服务器上注册。 尝试添加

<security-domain>yourSecurityDomain</security-domain>

<hornetq-server> 

你的standalone-full.xml中的标签 或创建一个 myName-jms.xml 并将其放置在您的 Wildfly 部署目录中,如下所示...(如果您需要队列,可以将主题替换为队列)

<?xml version="1.0" encoding="UTF-8"?>
<messaging-deployment xmlns="urn:jboss:messaging-deployment:1.0">
    <hornetq-server>
   <security-domain>myDomain</security-domain>
  <jms-destinations>
                <jms-topic name="myTopic">
                    <entry name="topic/myTopic"/>
                    <entry name="java:global/jms/myTopic"/>
                </jms-topic>             
 </jms-destinations>
</hornetq-server>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-06
    • 2022-09-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多