These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Problems with Session and transaction handling?
PostPosted: Mon Sep 22, 2008 3:10 am 
Beginner
Beginner

Joined: Tue Jun 17, 2008 12:14 am
Posts: 21
I have issue on random session close on my hibernate ejb:

Code:
public OrderHandler() throws NamingException {
logger.debug("Enter c'tor of OrderHandler()");
InitialContext ctx = new InitialContext();
SessionFactory sessionFac_report = new Configuration().configure().buildSessionFactory();
sesReporting = sessionFac_report.openSession();
}
...

public void saveToDatabase() throws Exception {
Transaction txReporting = null;       
try{             
   txReporting =sesReporting.beginTransaction();
...
}catch (Exception e) {            
if (txReporting != null) {
   // Something went wrong; discard all partial changes
   txReporting.rollback();
    }
    throw e;
   }       
}


it runs fine with small msg size (translate from a file 50 kb), and keep getting the session is closed when it reaches large msg size(translate from a file 2 Mb) with this:

Code:
2008-09-18 18:23:20,854 WARN  [com.arjuna.ats.arjuna.logging.arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_58] - Abort of action id accef56:5bf:48d22593:422 invoked while multiple threads active within it.
2008-09-18 18:23:20,854 WARN  [com.arjuna.ats.arjuna.logging.arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.CheckedAction_2] - CheckedAction::check - atomic action accef56:5bf:48d22593:422 aborting with 1 threads active!
2008-09-18 18:23:23,260 WARN  [com.arjuna.ats.arjuna.logging.arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_58] - Abort of action id accef56:5bf:48d22593:430 invoked while multiple threads active within it.
2008-09-18 18:23:23,260 WARN  [com.arjuna.ats.arjuna.logging.arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.CheckedAction_2] - CheckedAction::check - atomic action accef56:5bf:48d22593:430 aborting with 1 threads active!
2008-09-18 18:23:42,338 WARN  [com.arjuna.ats.arjuna.logging.arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_58] - Abort of action id accef56:5bf:48d22593:445 invoked while multiple threads active within it.
2008-09-18 18:23:42,338 WARN  [com.arjuna.ats.arjuna.logging.arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.CheckedAction_2] - CheckedAction::check - atomic action accef56:5bf:48d22593:445 aborting with 1 threads active!
2008-09-18 18:23:53,870 INFO  [txn.class com.flextronics.fftester.OrderHandler] 1066869,DEBF101,Administrator,10068927,Session is closed!,Thu Sep 18 18:23:53 SGT 2008
2008-09-18 18:23:53,885 ERROR [STDERR] org.hibernate.SessionException: Session is closed!
   at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:49)
   at org.hibernate.impl.SessionImpl.getActionQueue(SessionImpl.java:1817)
   at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:201)
   at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
   at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
   at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
...

I found other ppl have similar issue:
http://forum.hibernate.org/viewtopic.php?p=2335158
http://forum.hibernate.org/viewtopic.php?p=2373543
and also this:
Quote:
Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html


what's the best way to handles it?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 22, 2008 7:50 pm 
Beginner
Beginner

Joined: Tue Jun 17, 2008 12:14 am
Posts: 21
anyone?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 22, 2008 11:43 pm 
Expert
Expert

Joined: Mon Nov 26, 2007 2:29 pm
Posts: 443
Are you creating a configuration object every time you need a session?
It doesn't work that way.
The program is complaining because the original session is closed, and you try to create new ones each time.

What strategy are you using to manage your sessions?

_________________
Gonzalo Díaz


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 23, 2008 1:06 am 
Beginner
Beginner

Joined: Tue Jun 17, 2008 12:14 am
Posts: 21
Does something like this count?

Code:
public void onMessage(Message recvMsg)
   {...
OrderHandler oHandler = new OrderHandler();
...
oHandler.saveToDatabase();
...
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.