2 Replies Latest reply on Jan 24, 2014 4:38 AM by Mylos Kathos

    JMS 2.0 how to specify user credentials?

    Mylos Kathos Master

      Dear all,

      I'd need to use some capabilities of JMS 2.0 such as Automatic Connection Factory and Queue definition. I have elaborated the following code, which however fails because of Security checks ("Unable to validate user: null"). Is there a way to specify the username and password in JMS 2.0 so that I can use the following code ?

       

      @Stateless

      @JMSConnectionFactoryDefinition(name = "java:/MyConnectionFactory",

      className = "javax.jms.ConnectionFactory")

      @JMSDestinationDefinition(name = "java:jboss/jms/queue/myQueue",

      className = "javax.jms.Queue", interfaceName = "javax.jms.Queue")

      public class ManagerEJB {

       

          

            @Resource(mappedName = "java:jboss/jms/queue/myQueue")

           Queue myQueue;

          

           @Inject

           @JMSConnectionFactory("java:/MyConnectionFactory")

           private JMSContext context;

       

           public void sendMessage(String txt) {

               context.createProducer()

               .send(myQueue, txt);

           }

      }

      Thanks

      Mylos