3

I'm trying to use JMS 2.0 Automatic Resource Definition Feature. Here is the resources definition in a producer:

@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;

In a consumer:

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

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

I get the error with the previous configuration:

Caused by: HornetQSecurityException[errorType=SECURITY_EXCEPTION message=HQ119031: Unable to validate user: null] ... 166 more

java.lang.RuntimeException: javax.jms.JMSSecurityRuntimeException: HQ119031: Unable to validate user: null

How can I resolve it using annotations?

Alexandr
  • 9,213
  • 12
  • 62
  • 102

1 Answers1

1

Using annotations wont be enough I think. Seems that maybe your security domain isnt registered with your hornetq server. Try adding

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

under the

<hornetq-server> 

tag in your standalone-full.xml or create a myName-jms.xml and place it in your wildfly deployment directory like this...(you can replace topic with queue if u want a queue)

<?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>

DJ MERKEL
  • 87
  • 8