You can't operate on a closed Statement!!!

private static final String QUERY_PROCESS ="select * from t_wf_process where uuid =?";
@Override
public ProcessEntity getProcessEntity(String processUUID)throws SQLException {
ProcessEntity processEntity = null;
try {
connection = this.commonJDBC.getConnection();
ps = connection.prepareStatement(QUERY_PROCESS);
ps.setString(1, processUUID);
rs = ps.executeQuery();
if (rs.next()) {
processEntity = WFEngineConstant.fillProcessEntity(rs);
} else {
processEntity = null;
}
} catch (SQLException e) {
logger.info("GetProcessEntity abnormal", e);
} finally {
this.commonJDBC.cleanUp(connection, ps, rs); // Release resources
}
// Returns the process instance objects
return processEntity;
}
//Get connected*************
/**
* Access to Connection
*/
public Connection getConnection(){
Connection connection = this.template.getConnection();
try {
if (connection.isClosed()) {
connection = SqlSessionUtils.getSqlSession(
this.template.getSqlSessionFactory(),
this.template.getExecutorType(),
this.template.getPersistenceExceptionTranslator())
.getConnection();
}
} catch (Exception e) {
e.printStackTrace();
}
return connection;
}

//Close********

/**
* Close Connection,PreparedStatement,ResultSet
*/
public void cleanUp(Connection c,PreparedStatement ps,ResultSet rs){
this.closeResultSet(rs);
this.closePreparedStatement(ps);
this.closeConnection(c);

}
/**
* Close Connection
*/
public void closeConnection(Connection c){
try {
if (c != null) {
c.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}

/**
* Close PreparedStatement
*/
public void closePreparedStatement(PreparedStatement ps){
try {
if (ps != null) {
ps.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}

/**
* Close ResultSet
*/
public void closeResultSet(ResultSet rs){
try {
if (rs != null) {
rs.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
Using the c3p0 into the template template is connected
Sometimes thrown out as follows... But sometimes not so wrong... What is the reason. .

Throw the getProcessEntity abnormal´╝ü
You can't operate on a closed Statement!!!

Started by Godfery at December 15, 2016 - 6:54 AM

Posted by Bonnie at December 29, 2016 - 7:47 AM

I also encountered such a problem, I'm more of is, I this problem only occurs in the background management page, the page refresh user has no problem, only the background will be submitted to this anomaly, random. I am looking for a long time the solution, also did not solve

Posted by Moses at January 05, 2017 - 8:13 AM