IBM Support

J2CA0020E: The Connection Pool Manager could not allocate a Managed Connection: java.lang.IllegalStateException: Internal Error: cannot find the PoolManager Reference

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.

[{"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"--","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"9.0;8.5.5;8.0;7.0","Edition":"Base;Edition Independent;Network Deployment","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SSNVBF","label":"Runtimes for Java Technology"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Java SDK","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB36","label":"IBM Automation"}}]

Document Information

Modified date:
15 June 2018

UID

swg21206150