-->
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.  [ 10 posts ] 
Author Message
 Post subject: could not register synchronization with JTA TransactionManag
PostPosted: Sun Mar 07, 2004 3:11 am 
Newbie

Joined: Sat Mar 06, 2004 3:55 pm
Posts: 3
Please do note that this seems to happen only after a while.
The same use case runs fine initially .
Also this happens intermitently. It works sometimes. Sometimes it doesnt.
Also I am not having a transaction in this use case.
Any pointers/help will be appreciated. Also let me know if any other details required. thanks in advance

hibernate version 2.1
mysql-connector 3.0.0.
jboss 3.2.3. running hibernate as service..

Code:

public static Session getSession() throws BlogAggException {

try {
if (sf == null) sf =(SessionFactory) new InitialContext ().lookup(SESSION_FACTORY);
return sf.openSession();
} catch (NamingException e) {


public class GetItemsByDate extends Action {
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
Session session = null;
try {
session = HibernateServiceLocator.getSession();
} catch (BlogAggException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Date d = new Date(System.currentTimeMillis());
ItemDAO itemDAO = new ItemDAO();
Collection items = itemDAO.getItemsForDate(session, d);
for (Iterator iter = items.iterator(); iter.hasNext();) {
Item item = (Item) iter.next();
Collection hits = (Collection) item.getItemHits();
System.out.println("size" + hits.size());
}
System.out.println(items.size());
session.disconnect();

request.setAttribute("items", items);

return mapping.findForward("success");

}



//In itemDAO.
public Collection getItemsForDate(Session ses, Date date)
throws HibernateException {
System.out.println("in getItemsForDate");
log.debug("in getItemsForDate");
String queryString =
"select item from Item as item where item.foundDate > :date ";
Query query = ses.createQuery(queryString);
System.out.println(date);
query.setDate("date", date);

return query.list();



Stack trace
net.sf.hibernate.TransactionException: could not register synchronization with JTA TransactionManager
at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3175)
at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3140)
at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:61)
at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:703)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:184)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:132)
at net.sf.hibernate.loader.Loader.doList(Loader.java:949)
at net.sf.hibernate.loader.Loader.list(Loader.java:940)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:833)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1475)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at com.blogagg.hibernate.ItemDAO.getItemsForDate(ItemDAO.java:40)
at com.blogagg.struts.GetItemsByDate.execute(GetItemsByDate.java:55)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:220)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
at java.lang.Thread.run(Thread.java:534)
Caused by: javax.transaction.RollbackException: Already marked for rollback
at org.jboss.tm.TransactionImpl.registerSynchronization(TransactionImpl.java:689)
at net.sf.hibernate.impl.SessionImpl.connect


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 08, 2004 8:37 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Caused by: javax.transaction.RollbackException: Already marked for rollback
You try to use a tx that is already in a finished state.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 10, 2004 3:52 pm 
Pro
Pro

Joined: Tue Aug 26, 2003 1:24 pm
Posts: 213
Location: Richardson, TX
The same thing is happening with me, only it's with a newly created Session. There is absolutely no chance I'm using a Session with a finished transaction. I get this exception after creating a new Session and calling session.connection().isClosed() to double check that an active connection has been retrieved from the connection pool:
Code:
net.sf.hibernate.TransactionException: could not register synchronization with JTA TransactionManager
        at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3282)
        at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3244)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 10, 2004 3:57 pm 
Pro
Pro

Joined: Tue Aug 26, 2003 1:24 pm
Posts: 213
Location: Richardson, TX
I'm also getting the following log message from JBoss:
Code:
2004-03-10 12:43:38,221 WARN  [TransactionImpl] Transaction TransactionImpl:XidImpl [FormatId=257, GlobalId=localhost.localdomain//183, BranchQual=] timed out. status=STATUS_ACTIVE

I haven't a clue what this means, but I think it's related. :)

I know this isn't a JBoss forum, but does anyone have a clue what could be causing this?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 10, 2004 4:17 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
greg_barton wrote:
The same thing is happening with me, only it's with a newly created Session. There is absolutely no chance I'm using a Session with a finished transaction.

It's not about session, it's about tx. Actually this can happen with plain JDBC and Tx

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 10, 2004 4:21 pm 
Pro
Pro

Joined: Tue Aug 26, 2003 1:24 pm
Posts: 213
Location: Richardson, TX
Yeah. After doing a little research on the JBoss forums (which are a major pain to use!) it looks like there's a problem with rollback and deadlocks. Transactions are marked for rollback and left hanging. Later they're reused (or something like that) and an exception is thrown when an occupied transaction handler is picked. That's my first guess...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 10, 2004 7:34 pm 
Pro
Pro

Joined: Tue Aug 26, 2003 1:24 pm
Posts: 213
Location: Richardson, TX
Oh, peachy: http://jboss.org/index.html?module=bb&op=viewtopic&t=24946


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 21, 2004 4:05 pm 
Newbie

Joined: Thu Nov 11, 2004 1:23 pm
Posts: 5
Location: New York
greg_barton wrote:
I'm also getting the following log message from JBoss:
Code:
2004-03-10 12:43:38,221 WARN  [TransactionImpl] Transaction TransactionImpl:XidImpl [FormatId=257, GlobalId=localhost.localdomain//183, BranchQual=] timed out. status=STATUS_ACTIVE

I haven't a clue what this means, but I think it's related. :)

I know this isn't a JBoss forum, but does anyone have a clue what could be causing this?


I had a similar problem like this. I had a message bean running for more than couple of hours. Every time I run this bean I get this warning. If you look at JBoss configuration jboss-service.xml, there is a timeout for transactions which I believe is set for 30 seconds. My CMT bean's transaction ran for more than allowed time. That's why I got this message. After reducing the run time for my bean, this message disappreared.

- Scott


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 04, 2006 2:54 am 
Regular
Regular

Joined: Tue Dec 14, 2004 5:21 am
Posts: 104
Location: india
emmanuel wrote:
greg_barton wrote:
The same thing is happening with me, only it's with a newly created Session. There is absolutely no chance I'm using a Session with a finished transaction.

It's not about session, it's about tx. Actually this can happen with plain JDBC and Tx


me too getting the same error in JBoss. what could be the problem .
is there anything else i need to specify for using a JTA Transaction other than these two properties

<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>

will jboss support JTA by default or it should be configured

_________________
sHeRiN
thanks for your ratings ...... :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 04, 2006 4:02 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
greg_barton wrote:

This is user error.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 10 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.