12 Replies Latest reply on Jun 20, 2012 3:52 AM by sv_srinivaas

    Spring listener remote queue lookup fails

    sv_srinivaas

      hi, I'm using Jboss 7.1.1 Final and Hornet 2.2.13.Final and spring 2.5.6. Trying to configure a spring listener in Tomcat (6.0) to read messages from a JMS queue but I see the below exception being thrown in jms server whenever the listener tries to establish a connection to the queue inspite of giving the user and password details to the spring listener connection configuration.

       

      13:26:18,411 ERROR [org.hornetq.core.protocol.core.impl.HornetQPacketHandler] (Old I/O server worker (parentId: 400247875, [id: 0x17db4c43, jmsNode1.org.int/a.b.c.d:5445])) Failed to create session : HornetQException[errorCode=105 message=Unable to validate user: null]         at org.hornetq.core.security.impl.SecurityStoreImpl.authenticate(SecurityStoreImpl.java:147) [hornetq-core-2.2.13.Final.jar:]         at org.hornetq.core.server.impl.HornetQServerImpl.createSession(HornetQServerImpl.java:807) [hornetq-core-2.2.13.Final.jar:]         at org.hornetq.core.protocol.core.impl.HornetQPacketHandler.handleCreateSession(HornetQPacketHandler.java:187) [hornetq-core-2.2.13.Final.jar:]         at org.hornetq.core.protocol.core.impl.HornetQPacketHandler.handlePacket(HornetQPacketHandler.java:85) [hornetq-core-2.2.13.Final.jar:]         at org.hornetq.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:508) [hornetq-core-2.2.13.Final.jar:]         at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:556) [hornetq-core-2.2.13.Final.jar:]         at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:517) [hornetq-core-2.2.13.Final.jar:]         at org.hornetq.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:533) [hornetq-core-2.2.13.Final.jar:]         at org.hornetq.core.remoting.impl.netty.HornetQChannelHandler.messageReceived(HornetQChannelHandler.java:73) [hornetq-core-2.2.13.Final.jar:]         at org.jboss.netty.channel.SimpleChannelHandler.handleUps 13:26:18,078 INFO  [org.jboss.as.naming] (Remoting "node1" task-2) JBAS011806: Channel end notification received, closing channel Channel ID 6170c9e0 (inbound) of Remoting connection 548c6b37 to /10.145.133.32:1684

       

      Also I see the below exception from tomcat during startuip where the spring listener is deployed

       

      13:26:18,156 INFO  [org.jboss.as.naming] (Remoting "node1" task-1) JBAS011806: Channel end notification received, closing channel Channel ID 06bbefd0 (inbound) of Remoting connection 7ece9ff5 to null

       

      Note: Lookup to RemoteConnectionFactory and remote lookup to jms queue from a java client works fine without any issues but the issue occurs only when I try to configure the spring listener (running in tomcat) to a remote queue I've checked the Spring integration example that connects to a local queue and I changed the connection params to point to RemoteConnectionFactory and also changed the lookup to point to jms/queue/test for remote queue lookup but still it doesnt work. Pls help!

        • 1. Re: Spring listener remote queue lookup fails
          sv_srinivaas

          sorry, i was wrong in mentioning the source of exceptions.

           

          Got the below exception after every  2mins in the jms server

           

          13:26:18,411 ERROR [org.hornetq.core.protocol.core.impl.HornetQPacketHandler] (Old I/O server worker (parentId: 400247875, [id: 0x17db4c43, jmsNode1.org.int/a.b.c.d:5445])) Failed to create session : HornetQException[errorCode=105 message=Unable to validate user: null]         at org.hornetq.core.security.impl.SecurityStoreImpl.authenticate(SecurityStoreImpl.java:147) [hornetq-core-2.2.13.Final.jar:]         at org.hornetq.core.server.impl.HornetQServerImpl.createSession(HornetQServerImpl.java:807) [hornetq-core-2.2.13.Final.jar:]         at org.hornetq.core.protocol.core.impl.HornetQPacketHandler.handleCreateSession(HornetQPacketHandler.java:187) [hornetq-core-2.2.13.Final.jar:]         at org.hornetq.core.protocol.core.impl.HornetQPacketHandler.handlePacket(HornetQPacketHandler.java:85) [hornetq-core-2.2.13.Final.jar:]         at org.hornetq.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:508) [hornetq-core-2.2.13.Final.jar:]         at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:556) [hornetq-core-2.2.13.Final.jar:]         at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:517) [hornetq-core-2.2.13.Final.jar:]         at org.hornetq.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:533) [hornetq-core-2.2.13.Final.jar:]         at org.hornetq.core.remoting.impl.netty.HornetQChannelHandler.messageReceived(HornetQChannelHandler.java:73) [hornetq-core-2.2.13.Final.jar:]         at org.jboss.netty.channel.SimpleChannelHandler.handleUps 13:26:18,078 INFO  [org.jboss.as.naming] (Remoting "node1" task-2) JBAS011806: Channel end notification received, closing channel Channel ID 6170c9e0 (inbound) of Remoting connection 548c6b37 to /10.145.133.32:1684

           

          and the below exception againn in jms server whenever the spring litener tries to connect with the queue

           

          13:26:18,156 INFO  [org.jboss.as.naming] (Remoting "node1" task-1) JBAS011806: Channel end notification received, closing channel Channel ID 06bbefd0 (inbound) of Remoting connection 7ece9ff5 to null

           

          • 2. Re: Spring listener remote queue lookup fails
            ataylor

            You need to configure security in your server

            • 3. Re: Spring listener remote queue lookup fails
              sv_srinivaas

              Andy, Are you talking about creating application/management user and setting the user roles? If yes, then I have done that already in the jms node and also the MDB and java clients are able to connect securedly using the user id and pwd.The same user and password doesnt seem to work with spring listener. Am i supposed to set anything more on the server for server security? Thanks

              • 4. Re: Spring listener remote queue lookup fails
                ataylor

                have you added a user to the application realm?

                 

                what is your configuration?

                • 5. Re: Spring listener remote queue lookup fails
                  jbertram

                  Based on the exception you're seeing (i.e. "Unable to validate user: null") I would say that the problem is with the Spring listener.  It doesn't appear to be passing the proper credentials, or any credentials for that matter.

                  • 6. Re: Spring listener remote queue lookup fails
                    sv_srinivaas

                    hi thanks for your quick response, yes i did add an user to the application realm and mapped the same user to guest role as well and also updated application-roles.properties.

                     

                    I've attached the jms config xml file.

                    • 7. Re: Spring listener remote queue lookup fails
                      ataylor

                      How are you passing the credentials to the spring listener?

                      • 8. Re: Spring listener remote queue lookup fails
                        sv_srinivaas

                        Attached the spring configuration file.

                        • 9. Re: Spring listener remote queue lookup fails
                          ataylor

                          Im not a Spring expert but I can't see any where where you have set the connections credentials!

                          • 10. Re: Spring listener remote queue lookup fails
                            sv_srinivaas

                            Hi,

                             

                            The below section in the xml is where i have set the user and password credentials. I'm new to spring and may be its not the right place, I have also posted the same in spring forum as well. Thanks for your time.

                             

                            • 11. Re: Spring listener remote queue lookup fails
                              ataylor

                              where you have set it in the below section is just for JNDI security, you will need to also set iton the connection, Im sure the Spring guys (or google) can help you with this.

                              • 12. Re: Spring listener remote queue lookup fails
                                sv_srinivaas

                                You are right, spring provides another connectionFactory that can accept user credentials (shown below) that resolved the issue. Thank you so much!

                                 

                                <bean id="userCredentialsConnectionFactory"
                                    class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
                                    <property name="targetConnectionFactory">
                                      <ref bean="jmsQueueConnectionFactory" />
                                    </property>
                                    <property name="username" value="${jms.username}" />
                                    <property name="password" value="${jms.password}" />
                                  </bean>