3 Replies Latest reply on Apr 8, 2011 4:36 AM by Tiago Rico

    Unable to validate user in hornetq

    borfnorton22 borfnorton22 Newbie

      a) Brand new install of jboss 6 final

       

      b) modifying hornet configs under server/all/deploy/hornetq

       

      c) We define 1 queue in a file called test-hornetq-jms.xml such as:

       

         <queue name="testQueue">
            <entry name="/queue/testQueue"/>
         </queue>
      

       

      d) Our hornetq-users.xml has this in it

       

       

          <defaultuser name="guest" password="guest">
              <role name="guest"/>
          </defaultuser>
      
          <user name="MyTestUser" password="MyTestUser">
              <role name="subscriber"/>
          </user>
      

       

       

      e) Our hornetq-configuration.xml has this in it for the security settings

       

       

         <security-settings>
            <security-setting match="#">
               <permission type="createDurableQueue" roles="subscriber,publisher"/>
               <permission type="deleteDurableQueue" roles="subscriber,publisher"/>
               <permission type="createNonDurableQueue" roles="subscriber,publisher"/>
               <permission type="deleteNonDurableQueue" roles="subscriber,publisher"/>
               <permission type="createTempQueue" roles="subscriber,publisher"/>
               <permission type="consume" roles="subscriber,publisher"/>
               <permission type="send" roles="subscriber,publisher"/>
            </security-setting>
         </security-settings>
      

       

      f) In hornetq-jboss-beans.xml we tried BOTH enabling "HornetQSecurityManager" and "JBossASSecurityManager" one at a time after restarts to no avail

       

      g) We get the error messages below when trying to connect via some simple java command line client as below:

       

       

      qconFactory = (QueueConnectionFactory) ctx.lookup("ConnectionFactory");
      qcon = qconFactory.createQueueConnection("MyTestUser","MyTestUser");
      qsession = qcon.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
      queue = (Queue) ctx.lookup("/queue/testQueue");
      qreceiver = qsession.createReceiver(queue);
      qreceiver.setMessageListener(this);
      qcon.start();
      

       

       

      CLIENT ERROR

      Exception in thread "main" javax.jms.JMSSecurityException: Unable to validate user: MyTestUser
          at org.hornetq.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:287)
          at org.hornetq.core.client.impl.FailoverManagerImpl.createSession(FailoverManagerImpl.java:412)
          at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:1123)
          at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:849)
          at org.hornetq.jms.client.HornetQConnection.authorize(HornetQConnection.java:565)
          at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:624)
          at org.hornetq.jms.client.HornetQConnectionFactory.createQueueConnection(HornetQConnectionFactory.java:128)
          at QueueReceive.init(QueueReceive.java:83)
          at QueueReceive.main(QueueReceive.java:123)
      Caused by: HornetQException[errorCode=105 message=Unable to validate user: MyTestUser]
      

       

      SERVER.LOG error

      2011-02-25 23:34:58,967 ERROR [org.hornetq.core.protocol.core.impl.HornetQPacketHandler] (Old I/O server worker (parentId: 571516209, channelId: 1177396126, null => /0.0.0.0:5445)) Failed to create session : HornetQException[errorCode=105 message=Unable to validate user: MyTestUser]
              at org.hornetq.core.security.impl.SecurityStoreImpl.authenticate(SecurityStoreImpl.java:141) [:6.0.0.Final]
              at org.hornetq.core.server.impl.HornetQServerImpl.createSession(HornetQServerImpl.java:576) [:6.0.0.Final]
      
        • 1. Re: Unable to validate user in hornetq
          Tiago Rico Newbie

          Similar situation, same error here!

          I can run the security examples from trunk but in jboss as 6 final got the same problem!

           

          MDB

           

          @MessageDriven(activationConfig = {

                  @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),

                  @ActivationConfigProperty(propertyName = "destination", propertyValue = "topic/TestTopic"),

                  @ActivationConfigProperty(propertyName = "user", propertyValue = "bill"),

                  @ActivationConfigProperty(propertyName = "password", propertyValue = "hornetq")})

           

           

          Server LOG

           

          18:11:42,247 ERROR [org.hornetq.ra.inflow.HornetQActivation] Unable to reconnect org.hornetq.ra.inflow.HornetQActivation

          Spec(ra=org.hornetq.ra.HornetQResourceAdapter@26ed15da destination=topic/TestTopic destinationType=javax.jms.Topic ack=A

          uto-acknowledge durable=false clientID=null user=bill password=**** maxSession=10): HornetQException[errorCode=105 messa

          ge=Unable to validate user: bill]

                  at org.hornetq.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:287) [:6.0.0.Final]

                  at org.hornetq.core.client.impl.FailoverManagerImpl.createSession(FailoverManagerImpl.java:412) [:6.0.0.Final]

                  at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:1123) [:6.0.0.Final]

                  at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:849) [:6.0.0.Final]

                  at org.hornetq.ra.HornetQResourceAdapter.createSession(HornetQResourceAdapter.java:1293) [:6.0.0.Final]

                  at org.hornetq.ra.inflow.HornetQActivation.setupSession(HornetQActivation.java:351) [:6.0.0.Final]

                  at org.hornetq.ra.inflow.HornetQActivation.setup(HornetQActivation.java:289) [:6.0.0.Final]

                  at org.hornetq.ra.inflow.HornetQActivation.handleFailure(HornetQActivation.java:539) [:6.0.0.Final]

                  at org.hornetq.ra.inflow.HornetQActivation$SetupActivation.run(HornetQActivation.java:577) [:6.0.0.Final]

                  at org.jboss.resource.work.WorkWrapper.run(WorkWrapper.java:172) [:6.0.0.Final]

                  at org.jboss.threads.SimpleDirectExecutor.execute(SimpleDirectExecutor.java:33) [:2.0.0.CR7]

                  at org.jboss.threads.QueueExecutor.runTask(QueueExecutor.java:801) [:2.0.0.CR7]

                  at org.jboss.threads.QueueExecutor.access$100(QueueExecutor.java:45) [:2.0.0.CR7]

                  at org.jboss.threads.QueueExecutor$Worker.run(QueueExecutor.java:821) [:2.0.0.CR7]

                  at java.lang.Thread.run(Thread.java:619) [:1.6.0_21]

                  at org.jboss.threads.JBossThread.run(JBossThread.java:122) [:2.0.0.CR7]

           

          Same thing if I try with a client connection but now with a jms exception....

           

          Topic topic = (Topic) ic0.lookup("/topic/TestTopic");

          ConnectionFactory cf0 = (ConnectionFactory) ic0.lookup("/ConnectionFactory");

          connection0 = cf0.createConnection("bill", "hornetq");

           

          .........log...........

          javax.jms.JMSSecurityException: Unable to validate user: bill

                    at org.hornetq.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:287)

                    at org.hornetq.core.client.impl.FailoverManagerImpl.createSession(FailoverManagerImpl.java:412)

                    at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:1123)

                    at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:849)

                    at org.hornetq.jms.client.HornetQConnection.authorize(HornetQConnection.java:565)

                    at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:624)

                    at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:116)

                    at pt.isa.test.ClusteredTopicTest.runExample(ClusteredTopicTest.java:42)

                    at pt.isa.test.ClusteredTopicTest.main(ClusteredTopicTest.java:18)

          Caused by: HornetQException[errorCode=105 message=Unable to validate user: bill]

           

          Seams that hornet is not finding hornetq-users.xml that I placed inside server/{profile}/deploy/hornetq......

          What I'm missing here? Is this a jboss problem has I manage to run the security examples?

          borfnorton22 did you manage to solve the problem?

           

          Thanks in advance

          • 2. Unable to validate user in hornetq
            Peter Kormos Newbie

            We had the same problem so looked into the source code.

             

            When HornetQ is deployed in Jboss6, by default the username/password authentication is done via

             

            ...\jboss-6.0.0.Final\server\default\conf\props\hornetq-users.properties and not via hornetq-users.xml

             

            In this case, JBossASSecurityManager is used and not HornetQSecurityManagerImpl that would feed from hornetq-users.xml

             

            HTH,

             

            Peter

            • 3. Unable to validate user in hornetq
              Tiago Rico Newbie

              Thanks Peter,

              I took a look on the security manager and indeed it uses JBossASSecurityManager!

              Now it seems clear, but at the time I couldn't see that.

               

              Many thanks again!

              Rico