Hi,

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

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3836406#3836406

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3836406



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to