8 Replies Latest reply on Feb 10, 2015 9:58 AM by Justin Bertram

    Connection creation fails in hornetq 2.3.0

    Prakruthi V Newbie

      I am using hornetq 2.3.0 version in a standalone non-clustered mode and I am seeing this kind of error when creating a queue connection.  This problem happens rarely and randomly when there are a lot of messages processing at the same time. It works well otherwise.

       

      Code snippet to create a connection :

       

      this.qName = qName.getQName();

      qConnectionFactory = getQConnectionFactory();

      qConnection = qConnectionFactory.createQueueConnection();

      qSession = qConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

       

       

      public static QueueConnectionFactory getQConnectionFactory() throws NamingException {

         if (connectionFactory == null) {

            connectionFactory = (ConnectionFactory) jndiLookup("java:/XAConnectionFactory");

         }

         return (QueueConnectionFactory) connectionFactory;

      }

       

      Exception observed:

       

      Caused by: javax.jms.JMSException: Failed to create session factory

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

            at org.hornetq.jms.client.HornetQConnectionFactory.createQueueConnection(HornetQConnectionFactory.java:119)

            at org.hornetq.jms.client.HornetQConnectionFactory.createQueueConnection(HornetQConnectionFactory.java:114)

            at com.framework.GenericQueue.<init>(GenericQueue.java:79)

            at com.framework.SendQueue.<init>(SendQueue.java:58)

            at com.framework.SendQueue.replyMessage(SendQueue.java:100)

            at com.networkcontrol.NetworkControlServiceImpl$QueueHandler.handleMessage(NetworkControlServiceImpl.java:167)

            ... 9 more

      Caused by: org.hornetq.api.core.HornetQInterruptedException: java.lang.InterruptedException

            at org.hornetq.core.remoting.impl.netty.NettyConnection.write(NettyConnection.java:244)

            at org.hornetq.core.protocol.core.impl.ChannelImpl.send(ChannelImpl.java:267)

            at org.hornetq.core.protocol.core.impl.ChannelImpl.send(ChannelImpl.java:194)

            at org.hornetq.core.client.impl.ClientSessionFactoryImpl$PingRunnable.send(ClientSessionFactoryImpl.java:1765)

            at org.hornetq.core.client.impl.ClientSessionFactoryImpl.getConnection(ClientSessionFactoryImpl.java:1369)

            at org.hornetq.core.client.impl.ClientSessionFactoryImpl.getConnectionWithRetry(ClientSessionFactoryImpl.java:1069)

            at org.hornetq.core.client.impl.ClientSessionFactoryImpl.connect(ClientSessionFactoryImpl.java:246)

            at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:828)

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

            ... 15 more

      Caused by: java.lang.InterruptedException

            at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1301)

            at java.util.concurrent.Semaphore.acquire(Semaphore.java:317)

            at org.hornetq.core.remoting.impl.netty.NettyConnection.write(NettyConnection.java:175)

            ... 23 more

       

      Netty connector has been configured. Configuration in hornetq-configuration.xml:

       

      <configuration xmlns="urn:hornetq"

                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                     xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">

       

              <persistence-enabled>false</persistence-enabled>

              <security-enabled>false</security-enabled>

              <journal-directory>/tmp/hornetq</journal-directory>

       

         <!-- Connectors -->

         <connectors>

            <connector name="netty-connector">

               <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>

              <param key="host"  value="172.19.134.2"/>

            </connector>

         </connectors>

       

         <!-- Acceptors -->

         <acceptors>

            <acceptor name="netty-acceptor">

               <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>

              <param key="host"  value="172.19.134.2"/>

            </acceptor>

         </acceptors>

       

      </configuration>

       

      Can somebody help on this?