WebSphere interview question · Most asked

Users see errors and the logs show J2CA0045E: connection not available. How do you investigate?

Scenario

Members can save this page, take notes and track progress. See membership · Sign in

Summary

J2CA0045E means a request waited the full connection timeout for a pooled database connection and none became free: the pool is exhausted. Find out why connections are held: slow queries, long transactions, connection leaks (code that never closes connections), a downstream call made while holding a connection, or a pool too small for the load. Raising the maximum without understanding the cause usually just moves the problem to the database.

Longer Answer

  1. Pool metrics: PMI JDBC counters (pool size, free pool size, wait time, use time) or Liberty's ConnectionPool metrics through mpMetrics.
  2. Javacores during the problem: many threads waiting in getConnection, others holding connections in slow SQL or remote calls.
  3. Leaks: in traditional WAS, connection leak detection via the ConnectionLeakLogic trace; in code, use try-with-resources.
  4. Database side: long-running queries, locks, the database's own connection limit.
  5. Fix: correct the slow query or transaction scope, fix leaks, set a sensible connection timeout, then size the pool (max per server × servers ≤ database limit).

Key Points

  • Pool exhausted: requests waited the full timeout.
  • Find who holds connections: javacores and PMI.
  • Leaks, slow SQL and remote calls inside transactions are common.
  • Size the pool last, against the database limit.

Explanation

What interviewers look for

Using javacores and pool metrics to find the real cause.

More WebSphere questions

← All WebSphere questions

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake