JBoss 3.2.2 abnormal termination
rafcio May 27, 2004 4:45 AMHi,
we have sometimes abnormal JBoss 3.2.2 termination. It happens only on production. We can't reproduce it on out test instance. We have two JBoss instances (but not in cluster). JBoss crashes without any error message, while we make SQL queries directly, i.e.:
public int getCountOfMediaForMandant(Integer mandant_id) {
if (logger.isDebugEnabled()) {
logger.debug("getCountOfMediaForMandant('" + mandant_id + "') entered");
}
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
con = getConnection();
if (con != null) {
String query = "select count(m.media_id) from media m, users u where u.mandant_id = ? and m.user_id = u.user_id";
pstmt = con.prepareStatement(query);
pstmt.setInt(1, mandant_id.intValue());
rs = pstmt.executeQuery();
if (rs.next()) {
return rs.getInt(1);
}
}
return -1;
}
catch (SQLException sqle) {
logger.fatal("getCountOfMediaForMandant() failed", sqle);
return -1;
}
finally {
SQLUtils.getInstance().closeConnections(con, pstmt, rs);
}
}
getConnection() implementation:
public Connection getConnection() {
logger.debug("getConnection() entered");
try {
DataSource datasource = ServiceLocator.getInstance().getDataSource(JNDINamesDataSource.DEFAULT_DS);
if (datasource != null) {
return datasource.getConnection();
}
}
catch (ServiceLocatorException sle) {
logger.fatal("getConnection() failed", sle);
}
catch (SQLException sqle) {
logger.fatal("getConnection() failed", sqle);
}
logger.error("getConnection() can't get connection");
return null;
}
closeConnections() implementation:
public void closeConnections(Connection conn, Statement stmt, ResultSet rs) {
logger.debug("closeConnections() entered");
try {
if (rs != null) {
rs.close();
}
}
catch (SQLException sqle) {
logger.fatal("closeConnections() close rs failed", sqle);
}
try {
if (stmt != null) {
stmt.close();
}
}
catch (SQLException sqle) {
logger.fatal("closeConnections() close stmt failed", sqle);
}
try {
if (conn != null) {
conn.close();
}
}
catch (SQLException sqle) {
logger.fatal("closeConnections() close conn failed", sqle);
}
}
We are working with MySQL 4.0.18 and the MySQL-Connector 3.0.11 on Linux with J2SDK 1.4.2_04.
Regards,
Rafal