JMS connection and JMS session

Posted . Visible to the public.

When an application sends messages using JMS, it must open both a JMS connection and a JMS session.
For example:

QueueConnection jmsconn = qcf.createQueueConnection();
QueueSession session = jmsconn.createQueueSession(false,
Session.AUTO_ACKNOWLEDGE);
The JMS connection factory that is configured in WebSphere Application Server has connection pool and session pool settings. Each connection in the connection pool has its own session pool. The call to createQueueConnection() gets a connection from the connection pool and the call to createQueueSession() gets a session from the session pool for that connection.

If the JMS connection is closed, but the JMS session is not closed (for example, the JMS session might be cached), this problem might occur.
The JMS connection is returned to the connection pool when it is closed. If it remains in the pool for the Unused Timeout number of seconds (configured in the connection pool settings), the connection is discarded from the pool. When this occurs, the connection manager cleans up the connection, purges its session pool, and sets the PoolManager Reference to null. If the application tries to use the session again, the exception is issued.
To resolve this problem, the application must close the JMS session before it closes the JMS connection.

It is not recommended to cache sessions or connections. Doing so can cause this problem, or can cause connection wait timeouts.

======> If customer is closing sessions and connections closing properly and still seeing the same above problem then on next occurence recommend
to customer recreate issue with following JMS mustgather data:

http://www-01.ibm.com/support/docview.wss?uid=swg21153217 Show archive.org snapshot

With above traces and also please request to run the collector output also.

Based on the exception stack trace, it looks like they are calling
createTextMessage() on a JMS session, but the JMS connection that is
associated with the session is already closed ... most likely this
happens because they are re-using a JMS session instead of closing it
when they are finished with it and then getting a new JMS session.

To find out root cause of issue, please recreate issue with following
JMS mustgather data:

http://www-01.ibm.com/support/docview.wss?uid=swg21153217 Show archive.org snapshot

====================================================================================

Please go through the following technote for how to resolve above
issue:

http://www-01.ibm.com/support/docview.wss?rs=180&uid=swg21206150 Show archive.org snapshot

Fabio Silva
Posted by Fabio Silva to Fabio Silva's deck (2018-02-20 12:29)