Troubleshooting
Problem
Applications running in WebSphere Application Server that get JMS connections to an MQ queue manager or other JMS provider can produce the following exception intermittently:
[]
J2CA0020E: The Connection Pool Manager could not allocate a Managed Connection: java.lang.IllegalStateException: Internal Error: cannot find the PoolManager Reference.
at com.ibm.ejs.j2c.ConnectionManager.allocateMCWrapper
(ConnectionManager.java:616)
at com.ibm.ejs.j2c.ConnectionManager.associateConnection
(ConnectionManager.java:1295)
at com.ibm.ejs.jms.JMSSessionHandle.getOpenSession
(JMSSessionHandle.java:1184)
...[
]
If tracing is enabled, the following trace entry is seen before the exception:
[]
This should not happen! pm was null for cf name JMS$QCF$JMSManagedConnection@4026653[
]
Cause
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.
Resolving The Problem
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.
Was this topic helpful?
Document Information
Modified date:
15 June 2018
UID
swg21206150