-->
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: Could not register Synchronization
PostPosted: Wed Aug 04, 2004 8:12 pm 
Newbie

Joined: Wed Aug 04, 2004 8:07 pm
Posts: 2
Hello there,

has someone got this error?

javax.transaction.SystemException: You may enlist a resource only on a server

at weblogic.transaction.internal.TransactionImpl.registerSynchronization(TransactionImpl.java:457)

at net.sf.hibernate.transaction.JTATransaction.begin(JTATransaction.java:169)

at net.sf.hibernate.transaction.JTATransactionFactory.beginTransaction(JTATransactionFactory.java:58)

at net.sf.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:2156)

at usertmgmt.Main.main(Main.java:607)

net.sf.hibernate.TransactionException: Could not register Synchronization

at net.sf.hibernate.transaction.JTATransaction.begin(JTATransaction.java:173)

at net.sf.hibernate.transaction.JTATransactionFactory.beginTransaction(JTATransactionFactory.java:58)

at net.sf.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:2156)

at com.rubiconsoft.Main.main(Main.java:607)

[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 05, 2004 10:27 am 
Expert
Expert

Joined: Fri Feb 06, 2004 7:49 am
Posts: 255
Location: Moscow, Russia
I guess, it is because of not properly configured hibernate properites (hibernate.property, hibernate.cfg.xml)

Quote:
javax.transaction.SystemException: You may enlist a resource only on a server
at weblogic.transaction.internal.TransactionImpl.registerSynchronization(TransactionImpl.java:457)

What is your environment? In your case hibernate configured to work inside Weblogic container managed environment. I guess, you are trying to use the same configs outside Weblogic
Quote:
usertmgmt.Main.main(Main.java:607)


--
Leonid


Top
 Profile  
 
 Post subject: Could not register Synchronization
PostPosted: Thu Aug 05, 2004 12:54 pm 
Newbie

Joined: Wed Aug 04, 2004 8:07 pm
Posts: 2
Hi Leonid

Thank you very much for the quick response.

It would be of a great help for me, if you can send me the properties to
be configured in hibernate.properties.
I am trying to use Weblogic App server with a Stateless/Stateful session
bean having the Hibernate access. i.e. I need to open a session and
execute the queries on the persistent objects in the Session EJB.

Also, if possible pls explain me as to how transaction works in this scenario. Can i use container managed transactions? If so, how do i do it?

You can add me on yahoo IM if required. My Yahoo id is: indianmanju@yahoo.com

Thanks
Manju


Top
 Profile  
 
 Post subject: Re: Could not register Synchronization
PostPosted: Fri Aug 06, 2004 3:15 am 
Expert
Expert

Joined: Fri Feb 06, 2004 7:49 am
Posts: 255
Location: Moscow, Russia
indianmanju wrote:
It would be of a great help for me, if you can send me the properties to
be configured in hibernate.properties.
I am trying to use Weblogic App server with a Stateless/Stateful session
bean having the Hibernate access. i.e. I need to open a session and
execute the queries on the persistent objects in the Session EJB.

Pardon, but I have not used hibernate with Weblogic and know nothing about configuring hibernate to work with Weblogic.

Quote:
Also, if possible pls explain me as to how transaction works in this scenario. Can i use container managed transactions? If so, how do i do it?

If you use properly configured hibernate inside CMT environment, container manages all hibernate transactions, so you don't need to call tx = sess.beginTransaction() and tx.commit(), but if you call, it does not start and does not commit transaction (container does it for you), and don't forget to call sessionContext.setRollbackOnly() on all application level exceptions.

http://forum.hibernate.org/viewtopic.php?p=2193148#2193148
Here michael desribes me and other guys how to work with hibernate inside CMT.

I use the following approach for all Session Beans:
Code:
try
{
    session = HibernateUtil.currentSession();
    //...
    session.flus();
}
catch (HibernateException e)
{
    sessionContext.setRollbackOnly();
    log.error("...", e);
    throw new ApplicationLevelException(...);
}
catch (ApplicationLevelException e)
{
    sessionContext.setRollbackOnly();
    log.error("...", e);
    throw e;
}
finally
{
    HibernateUtil.closeSession();
}


To get hibernate session use HibernateUtil from CaveatEmptor example http://caveatemptor.hibernate.org/5.html

--
Leonid


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.