We promoted new code to our production environment, and the application would not work.
The root error was: J2CA0045E: Connection not available while invoking method createOrWaitForConnection for resource jdbc/ORXAemployees.
The trace file appeared to indicate that the application used up all the connections in the connection pool, and eventually returned them. At least we seen that 10 connection close requests were issued (the max connections in the pool), and other applications waited until the application completed the response.
It turns out that the domain table was empty. Inserting one row to the table resolved the problem. Any ideas why this would be the case? Below are some specifics about our environment.
Thanks!
We tried the following connection settings:
Direct
Code:
<property name="hibernate.connection.datasource">jdbc/ORXAemployees</property>
Indirect
Code:
<property name="hibernate.connection.datasource">java:comp/env/jdbc/ORXAemployees</property>
The code to call the database:
Code:
@SessionTarget
Session session;
@TransactionTarget
Transaction transaction;
String tSQL = "from Employee emp " +
"where emp.eventDate >= to_date('" + strBegDate + "','yyyy-mm-dd') and " +
" emp.eventDate <= to_date('" + strEndDate + "','yyyy-mm-dd') ";
StringBuffer hSQL = new StringBuffer(tSQL);
if(division != null) {
hSQL.append("and emp.divisionName = '" + division + "' ");
}
hSQL.append("order by emp.eventDate, emp.divisionName ");
List<Employee> lstEmployee = new ArrayList<Employee>();
lstEmployee = session.createQuery(hSQL.toString()).list();
Environment:
Application Server: IBM Websphere Application Server 7.0
DB Server: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
JDBC Driver: Oracle JDBC driver, version: 11.1.0.7.0-Production
MVC Framework: Struts2 version 2.1.6
Object/Relational Mapping: Hibernate 3.3.0.SP1