I am having some junit test cases are running on jenkins, but some of then are failed on jenkins, however I have them ran successfully in my local laptop.org.hibernate.SessionException: Session is closed!
at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:72)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1688)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347)
at com.test.ui.struts.module.config.ReadAction.executeImpl(ReadAction.java:144)
at com.test.ui.struts.module.config.CrudDataAction.execute(CrudDataAction.java:120)
Here is the code I have in ReadAction.java
session = sf.getCurrentSession();
try
{
if (!session.getTransaction().isActive())
session.beginTransaction();
Criteria c = session.createCriteria(metaBean.getEntityName());
setProjection(metaBean, c);
// fetch 1 more row than we can return to see if we have limited the result set
c.setMaxResults(_maxRows + 1);
c.add(getRestrictions(metaBean, reqBean));
List result = c.list();//This is line 144
I do not see any reason that the session will be close here, any ideal?