8 Replies Latest reply on Feb 7, 2010 2:18 PM by timfox

    HornetQException(unable to validate user: null) cause the loss of messages

    farmerzen

      Hi to all,

       

      I've my app. on Jboss 5.1.0.GA and uses the HornetQ 2.0.0. All goes fine but from time to time I get this strange exception.

      This happens when the message is putted in the queue and then she never reaches the MDB. This causes the loss of the message because the exception cannot be caught and then no rollback is done!

      Hornet is proper configured with UsersRolesLoginModule so why is user null?


      2010-02-05 17:26:10,644 SEVERE [org.hornetq.core.server.impl.ServerSessionImpl] Failed to send message
      HornetQException[errorCode=105 message=Unable to validate user: null for check type SEND for address jms.queue.DLRQueue]
              at org.hornetq.core.security.impl.SecurityStoreImpl.check(SecurityStoreImpl.java:180)
              at org.hornetq.core.server.impl.ServerSessionImpl.send(ServerSessionImpl.java:2513)
              at org.hornetq.core.server.impl.ServerSessionImpl.doSend(ServerSessionImpl.java:2334)
              at org.hornetq.core.server.impl.ServerSessionImpl.handleSend(ServerSessionImpl.java:1040)
              at org.hornetq.core.server.impl.ServerSessionPacketHandler.handlePacket(ServerSessionPacketHandler.java:270)
              at org.hornetq.core.remoting.impl.ChannelImpl.handlePacket(ChannelImpl.java:606)
              at org.hornetq.core.remoting.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:397)
              at org.hornetq.core.remoting.impl.RemotingConnectionImpl.access$000(RemotingConnectionImpl.java:41)
              at org.hornetq.core.remoting.impl.RemotingConnectionImpl$1.run(RemotingConnectionImpl.java:357)
              at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:96)
              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
              at java.lang.Thread.run(Thread.java:619)

       

      Any ideas? Where I should start digging?

      Many thanks

      Rico

        • 1. Re: HornetQException(unable to validate user: null) cause the loss of messages
          ataylor
          do the examples work? if not i would try reisntalling HornetQ as you installation looks screwed.
          • 2. Re: HornetQException(unable to validate user: null) cause the loss of messages
            clebert.suconic

            I guess what the user is saying is the transaction is not marked as rollback only (and throwing an exception) when a security exception happens.

             

             

            This test would fail at SecurityTest.java

             

               public void testSendTX() throws Exception
               {
                  Configuration configuration = createDefaultConfig(false);
                  configuration.setSecurityEnabled(true);
                  HornetQServer server = createServer(false, configuration);
            
                  try
                  {
                     server.start();
                     HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
                     HornetQSecurityManager securityManager = server.getSecurityManager();
                     securityManager.addUser("auser", "pass");
                     Role role = new Role("arole", false, false, true, false, false, false, false);
                     Set<Role> roles = new HashSet<Role>();
                     roles.add(role);
                     securityRepository.addMatch(SecurityTest.addressA, roles);
                     securityManager.addRole("auser", "arole");
                     ClientSessionFactory cf = createInVMFactory();
                     ClientSession session = cf.createSession("auser", "pass", false, true, true, false, -1);
                     session.createQueue(SecurityTest.addressA, SecurityTest.queueA, true);
                     ClientProducer cp = session.createProducer(SecurityTest.addressA);
                     cp.send(session.createMessage(false));
            
                     boolean ex = false;
                     try
                     {
                        session.commit();
                     }
                     catch (HornetQException e)
                     {
                        ex = true;
                        e.printStackTrace();
                        Assert.assertEquals(HornetQException.SECURITY_EXCEPTION, e.getCode());
                     }
                     assertTrue(ex);
                     session.close();
                  }
                  finally
                  {
                     if (server.isStarted())
                     {
                        server.stop();
                     }
                  }
               }
            
            
            
            

             

             

             

            any thoughts?

            • 3. Re: HornetQException(unable to validate user: null) cause the loss of messages
              clebert.suconic

              OOps, my bad.. I forgot to use a transaction session on my example.. ignore my last post

               

               

              Rico, When you send non-blocking messages, the security exception will be only received on the client when doing a commit, so you have to make sure you're using transaction (if you expect to have security exceptions).

               

               

              Now, I didn't understand if your problem was related to authentication not working properly, or if you're complaining about security not giving you exceptions at the client. (what could happen due to non-blocking messages).

              • 4. Re: HornetQException(unable to validate user: null) cause the loss of messages
                timfox
                • 5. Re: HornetQException(unable to validate user: null) cause the loss of messages
                  farmerzen

                  Andy,

                  Thanks for your reply.

                  I will check the examples and my installation.

                   

                  Rico

                  • 6. Re: HornetQException(unable to validate user: null) cause the loss of messages
                    farmerzen

                    Hi Clebert,

                    Many thanks for your reply.

                     

                    Sorry but I forgot to say that I use JMS (javax.jms) in all the process and then the Hornet implementation in a lower level.

                     

                    I think my problem is conserning with the authentication not working properly.

                     

                    My transaction is done in the 'server', not in MDB. MDB only does some tasks with the message.


                    Has I said:

                    1º It only happens from time to time, not allways.

                    2º Since I send the message to the queue, I can say that the transaction his commited (if I get no JMSException).

                    3º Hornet throws the HornetQException. Since is not catched anywhere  (JMS or by me) I cannot rollback the transaction.

                     

                    Hope I got more clear this time

                     

                    Thanks again,

                    Rico

                    • 7. Re: HornetQException(unable to validate user: null) cause the loss of messages
                      farmerzen

                      Hi Tim,

                       

                      Thanks for your reply.

                       

                      Sorry if I've been miss understood.

                      I will take a look at the user manual again and the anti-pattern guide.

                       

                      I will post something when I got some news/doubts about this.

                       

                      Thanks

                      Rico

                      • 8. Re: HornetQException(unable to validate user: null) cause the loss of messages
                        timfox

                        If you can post a test case which reproduces the issue, someone will investigate further.

                         

                        Also, creating the test case, and isolating the issue will help you understand the issue better.