This is a strange problem, session is closed unexpectedly. And even worse, I can not reproduce the problem. I am using Websphere 5.0.2, UDB 8.1 and Hibernate 2.0. The process is try to convert a few XML to PDF via FOP and update database with these documents attributes (like, subject, release date etc...). In the code, I opened one session, and one tranaction for this process. To illustrate what I do, here is the main logic:
try {
Session session = HibernateUtil.currentSession();
HibernateUtil.beginTransaction();
loop on docuemtns {
updateSubject(session, docuement);
handleXML(document);//XML docuement manipulation
XML2PDF(docuement);
updateRelease(session, docuemnt)
}
HibernateUtil.commitTransaction();
}catch(Exception e) {
HibenateUtil.rollback();
}finally {
HibernateUtil.closeSession();
}
HibernateUtil implements local thread approach.
When I have considerable docuements to convert to PDF, the session is closed unexpectedly after handleXML(document). This method does not invlove any database operation and any POJO objects, it is pure XML Document manipulation. The wired thing is, if the session is closed for one docuement, I make the process to handle this document only it never failed. And if I repeat the process on the entire document set, it may run successfully or close the session for another document handling. It is totally unpredictable. But any failure does not really roll back the transaction, these updates and inserts are commited!.
Any idea? Thanks in advance.
|