Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-20134

[GSS](7.3.z) ENTMQBR-3817 - The createSession() method throws java.lang.NullPointerException

    XMLWordPrintable

Details

    Description

      When calling a createSession on connection a java.lang.NullPointerException is thrown

      java.lang.NullPointerException
      	at org.apache.activemq.artemis.jms.client.ActiveMQConnection.createSessionInternal(ActiveMQConnection.java:619)
      	at org.apache.activemq.artemis.jms.client.ActiveMQConnection.createQueueSession(ActiveMQConnection.java:435)
      

      Looking at the code the same issue exist in EAP 7.3.0.GA with later version or Artemis. The NPE is caused by ClientSessionFactory.Impl.createSessionInternal() method returning null if a connection is already closed. This condition may be triggered if multiple threads are trying to use a connection. If one thread closes a connection while another is trying to create a session the NPE may be triggered.

      I think it would be wise to check for null in

      ActiveMQConnection.createSessionInternal()

      before calling

      session.addFailureListener(listener);

      and throw an exception if it is.

      Attachments

        Issue Links

          Activity

            People

              rhn-support-jbertram Justin Bertram
              rhn-support-toross Tom Ross
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: