Topic
  • 5 replies
  • Latest Post - ‏2012-10-03T19:24:49Z by sutter
Rachid_AAB
Rachid_AAB
3 Posts

Pinned topic WAS 7 Hibernate3.2 JTA EJB3 : Current transaction is not in progress

‏2012-09-27T14:01:35Z |
Hello,

After Migrating an Application J2EE from JDK 1.4 to JDK6, WAS6.1 to WAS7, EJB2 to EJB3 (Ejb session: persistence with Hibernate3.2 : No JPA); An Error is blocking transaction to an DB Oracle (We use JTA).

Error traced : "Current transaction is not in progress".

This error is occured when we tray to instanciate/recupere current session hibernate from SessionFactory:

sessionFactory.getCurrentSession();


Extract of file config Hibernate.cfg.xml:

<hibernate-configuration> <session-factory> <property name=
"session_factory_name">Mgb/HibernateFactory</property> <property name=
"show_sql">false</property> <property name=
"connection.datasource">jdbc/mgb</property> <property name=
"dialect">org.hibernate.dialect.Oracle10gDialect</property> <property name=
"hibernate.jta.UserTransaction">java:comp/UserTransaction</property> <property name=
"hibernate.current_session_context_class">org.hibernate.context.JTASessionContext</property> <property name=
"hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property> <property name=
"hubernate.transaction.manager_lookup_class">org.hibernate.transaction.WebSphereExtendedJTATransactionLookup</property> . . . </session-factory> <hibernate-configuration>


Some One Can Help me Please To resolve this probleme?

Thank you for advance.
Updated on 2012-10-03T19:24:49Z at 2012-10-03T19:24:49Z by sutter
  • sutter
    sutter
    94 Posts

    Re: WAS 7 Hibernate3.2 JTA EJB3 : Current transaction is not in progress

    ‏2012-09-27T21:19:57Z  
    Hi Rachid,
    Sorry, you probably won't find a lot of Hibernate expertise in this forum. The JPA solution as provided by WebSphere is based on the JPA specification. The basis of the solution is Apache OpenJPA, with WebSphere providing some key features and function beyond the Apache deliverables.

    The use of Hibernate as a persistence provider is beyond the support scope of WebSphere.

    Given all of that, I do have a couple of insights or comments that may or may not help.

    1) This might be a typo on your part, but the session-factory property you posted below is spelled wrong. It should be "hibernate", not "hubernate":
    <property name="hubernate.transaction.manager_lookup_class">org.hibernate.transaction.WebSphereExtendedJTATransactionLookup</property>

    2) There is an article on Developer Works that talks about using "classic" Session-based Hibernate with WebSphere. You might want to reference that article for some helpful hints:
    http://www.ibm.com/developerworks/websphere/techjournal/0609_alcott/0609_alcott.html

    3) Finally, if and when you consider moving to the JPA programming model, I would strongly suggest checking out the JPA solution that comes with WebSphere:
    http://www.ibm.com/developerworks/websphere/techjournal/1008_col_sutter/1008_col_sutter.html

    Hope this helps,
    Kevin Sutter, JPA Architect, IBM WebSphere
  • Rachid_AAB
    Rachid_AAB
    3 Posts

    Re: WAS 7 Hibernate3.2 JTA EJB3 : Current transaction is not in progress

    ‏2012-09-28T00:22:45Z  
    • sutter
    • ‏2012-09-27T21:19:57Z
    Hi Rachid,
    Sorry, you probably won't find a lot of Hibernate expertise in this forum. The JPA solution as provided by WebSphere is based on the JPA specification. The basis of the solution is Apache OpenJPA, with WebSphere providing some key features and function beyond the Apache deliverables.

    The use of Hibernate as a persistence provider is beyond the support scope of WebSphere.

    Given all of that, I do have a couple of insights or comments that may or may not help.

    1) This might be a typo on your part, but the session-factory property you posted below is spelled wrong. It should be "hibernate", not "hubernate":
    <property name="hubernate.transaction.manager_lookup_class">org.hibernate.transaction.WebSphereExtendedJTATransactionLookup</property>

    2) There is an article on Developer Works that talks about using "classic" Session-based Hibernate with WebSphere. You might want to reference that article for some helpful hints:
    http://www.ibm.com/developerworks/websphere/techjournal/0609_alcott/0609_alcott.html

    3) Finally, if and when you consider moving to the JPA programming model, I would strongly suggest checking out the JPA solution that comes with WebSphere:
    http://www.ibm.com/developerworks/websphere/techjournal/1008_col_sutter/1008_col_sutter.html

    Hope this helps,
    Kevin Sutter, JPA Architect, IBM WebSphere
    Hi Kevin,

    Thank you for your response, il's interesting.

    I will also contact the support of Hibernate and others forums of technologies Java, because I must, firstly, try to resolve the probleme using Hibernate as a persistence provider; it's work well in WAS6.1!! and moving to JPA is not my choice for the moment.

    1) It should be "hibernate", not "hubernate":
    You are right, its a typo.

    _2) article Hibernate "classic":http://www.ibm.com/developerworks/websphere/techjournal/0609_alcott/0609_alcott.html_
    Thank you, It 's really an interesting article, I read it previously, but I didn't found any contradiction; I attempt to use CMT not JTA but the same error appears! :'(

    _3) Moving to the JPA programming model: http://www.ibm.com/developerworks/websphere/techjournal/1008_col_sutter/1008_col_sutter.html_
    We use WAS7, so I think JPA 2.0, only not enough time to move to JPA (It's possible if I'm sure that's the unique solution, or maybe after fixing this.).
    Thanks again, and I'm expecting any other proposal on your part or any other someone.

    Bests Regards,
    Rachid AABIDI
  • sutter
    sutter
    94 Posts

    Re: WAS 7 Hibernate3.2 JTA EJB3 : Current transaction is not in progress

    ‏2012-09-28T13:40:04Z  
    Hi Kevin,

    Thank you for your response, il's interesting.

    I will also contact the support of Hibernate and others forums of technologies Java, because I must, firstly, try to resolve the probleme using Hibernate as a persistence provider; it's work well in WAS6.1!! and moving to JPA is not my choice for the moment.

    1) It should be "hibernate", not "hubernate":
    You are right, its a typo.

    _2) article Hibernate "classic":http://www.ibm.com/developerworks/websphere/techjournal/0609_alcott/0609_alcott.html_
    Thank you, It 's really an interesting article, I read it previously, but I didn't found any contradiction; I attempt to use CMT not JTA but the same error appears! :'(

    _3) Moving to the JPA programming model: http://www.ibm.com/developerworks/websphere/techjournal/1008_col_sutter/1008_col_sutter.html_
    We use WAS7, so I think JPA 2.0, only not enough time to move to JPA (It's possible if I'm sure that's the unique solution, or maybe after fixing this.).
    Thanks again, and I'm expecting any other proposal on your part or any other someone.

    Bests Regards,
    Rachid AABIDI
    Hi Rachid_AAB,
    Like I mentioned, I'm not sure that the proper expertise exists on this forum, but you will need to post more information on the error/exception you are receiving. What happens when you call getCurrentSession()? What Exception is received? Any call stacks? Any messages in System logs or FFDC? Have you tried turning on trace for either WebSphere (Container, Transactions, ???) or Hibernate?

    Good luck,
    Kevin Sutter, JPA Architect, IBM WebSphere
  • Rachid_AAB
    Rachid_AAB
    3 Posts

    Re: WAS 7 Hibernate3.2 JTA EJB3 : Current transaction is not in progress

    ‏2012-10-02T18:28:43Z  
    • sutter
    • ‏2012-09-28T13:40:04Z
    Hi Rachid_AAB,
    Like I mentioned, I'm not sure that the proper expertise exists on this forum, but you will need to post more information on the error/exception you are receiving. What happens when you call getCurrentSession()? What Exception is received? Any call stacks? Any messages in System logs or FFDC? Have you tried turning on trace for either WebSphere (Container, Transactions, ???) or Hibernate?

    Good luck,
    Kevin Sutter, JPA Architect, IBM WebSphere
    Hi Sutter,

    The Exception catched in logs (SystemErr of Websphere) when I call getCurrentSession() is an HibernateException :
    
    [02/10/12 14:51:22:000 WET] 00000014 NamingHelper  I org.hibernate.util.NamingHelper getInitialContext JNDI InitialContext properties:
    {
    } [02/10/12 14:51:22:000 WET] 00000014 FacadeUtil    E com.ideo.sweetdev.core.facade.FacadeUtil executeMethod Current transaction is not in progress org.hibernate.HibernateException: Current transaction is not in progress [02/10/12 14:51:22:000 WET] 00000014 SystemErr     R *org.hibernate.HibernateException: Current transaction is not in progress* at org.hibernate.context.JTASessionContext.currentSession(JTASessionContext.java:67) at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:542) at com.bps.mgb.business.hibernate.MySessionController.getCurrentSession(MySessionController.java:169) at com.bps.mgb.business.data.controller.AdministrationDataController.findAllGroupesUtilisateur(AdministrationDataController.java:55) at com.bps.mgb.business.controller.AdministrationBusinessController.findAllGroupesUtilisateur(AdministrationBusinessController.java:55) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at com.ideo.sweetdev.core.util.ReflectHelper.invokeStaticMethod(ReflectHelper.java:416) at com.ideo.sweetdev.core.service.broker.objectconnector.ObjectConnector.callStaticMethod(ObjectConnector.java:312) at com.ideo.sweetdev.core.service.broker.objectconnector.ObjectConnector.execute(ObjectConnector.java:166) at com.ideo.sweetdev.core.service.broker.Broker.executeService(Broker.java:369) at com.ideo.sweetdev.core.service.broker.Broker.execute(Broker.java:252) at com.ideo.sweetdev.core.facade.FacadeUtil.executeMethod(FacadeUtil.java:223) at com.ideo.sweetdev.core.facade.FacadeUtil.execute(FacadeUtil.java:168) at com.bps.mgb.ejb.facade.EjbFacade.execute(EjbFacade.java:40) at com.bps.mgb.ejb.facade.EJSRemote0SLEjbFacade_e2edc723.execute(EJSRemote0SLEjbFacade_e2edc723.java) at com.bps.mgb.ejb.facade._EJSRemote0SLEjbFacade_e2edc723_Tie.execute(_EJSRemote0SLEjbFacade_e2edc723_Tie.java) at com.bps.mgb.ejb.facade._EJSRemote0SLEjbFacade_e2edc723_Tie._invoke(_EJSRemote0SLEjbFacade_e2edc723_Tie.java) at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:623) at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:476) at com.ibm.rmi.iiop.ORB.process(ORB.java:513) at com.ibm.CORBA.iiop.ORB.process(ORB.java:1574) at com.ibm.rmi.iiop.Connection.respondTo(Connection.java:2845) at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2718) at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:63) at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:118) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
    


    The Hibernate jar is 'hibernate3.2.0.cr5.jar', when I look for the origine of this error into the source jar, I found that a condition about value of status transaction is not respected (not in {0, 1} => cf. ErrorThrowed.bmp).

    This transaction is instanciate and managed by a TransactionManager of Websphere, defined in config file like this:
    
    <property name=
    "hibernate.transaction.manager_lookup_class">org.hibernate.transaction.WebSphereExtendedJTATransactionLookup</property>
    


    FYI: My IDE is RAD7.5 + WAS7.0.0.15

    I don't find any other thinks about this error on trace of WAS (FFDC), even after activating trace Websphere, and i suspect compatbility between this version of hibernate and WAS7.0.0.15 ?
    Thinks advice,

    Rachid
  • sutter
    sutter
    94 Posts

    Re: WAS 7 Hibernate3.2 JTA EJB3 : Current transaction is not in progress

    ‏2012-10-03T19:24:49Z  
    Hi Sutter,

    The Exception catched in logs (SystemErr of Websphere) when I call getCurrentSession() is an HibernateException :
    <pre class="jive-pre"> [02/10/12 14:51:22:000 WET] 00000014 NamingHelper I org.hibernate.util.NamingHelper getInitialContext JNDI InitialContext properties: { } [02/10/12 14:51:22:000 WET] 00000014 FacadeUtil E com.ideo.sweetdev.core.facade.FacadeUtil executeMethod Current transaction is not in progress org.hibernate.HibernateException: Current transaction is not in progress [02/10/12 14:51:22:000 WET] 00000014 SystemErr R *org.hibernate.HibernateException: Current transaction is not in progress* at org.hibernate.context.JTASessionContext.currentSession(JTASessionContext.java:67) at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:542) at com.bps.mgb.business.hibernate.MySessionController.getCurrentSession(MySessionController.java:169) at com.bps.mgb.business.data.controller.AdministrationDataController.findAllGroupesUtilisateur(AdministrationDataController.java:55) at com.bps.mgb.business.controller.AdministrationBusinessController.findAllGroupesUtilisateur(AdministrationBusinessController.java:55) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at com.ideo.sweetdev.core.util.ReflectHelper.invokeStaticMethod(ReflectHelper.java:416) at com.ideo.sweetdev.core.service.broker.objectconnector.ObjectConnector.callStaticMethod(ObjectConnector.java:312) at com.ideo.sweetdev.core.service.broker.objectconnector.ObjectConnector.execute(ObjectConnector.java:166) at com.ideo.sweetdev.core.service.broker.Broker.executeService(Broker.java:369) at com.ideo.sweetdev.core.service.broker.Broker.execute(Broker.java:252) at com.ideo.sweetdev.core.facade.FacadeUtil.executeMethod(FacadeUtil.java:223) at com.ideo.sweetdev.core.facade.FacadeUtil.execute(FacadeUtil.java:168) at com.bps.mgb.ejb.facade.EjbFacade.execute(EjbFacade.java:40) at com.bps.mgb.ejb.facade.EJSRemote0SLEjbFacade_e2edc723.execute(EJSRemote0SLEjbFacade_e2edc723.java) at com.bps.mgb.ejb.facade._EJSRemote0SLEjbFacade_e2edc723_Tie.execute(_EJSRemote0SLEjbFacade_e2edc723_Tie.java) at com.bps.mgb.ejb.facade._EJSRemote0SLEjbFacade_e2edc723_Tie._invoke(_EJSRemote0SLEjbFacade_e2edc723_Tie.java) at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:623) at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:476) at com.ibm.rmi.iiop.ORB.process(ORB.java:513) at com.ibm.CORBA.iiop.ORB.process(ORB.java:1574) at com.ibm.rmi.iiop.Connection.respondTo(Connection.java:2845) at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2718) at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:63) at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:118) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604) </pre>

    The Hibernate jar is 'hibernate3.2.0.cr5.jar', when I look for the origine of this error into the source jar, I found that a condition about value of status transaction is not respected (not in {0, 1} => cf. ErrorThrowed.bmp).

    This transaction is instanciate and managed by a TransactionManager of Websphere, defined in config file like this:
    <pre class="jive-pre"> <property name= "hibernate.transaction.manager_lookup_class">org.hibernate.transaction.WebSphereExtendedJTATransactionLookup</property> </pre>

    FYI: My IDE is RAD7.5 + WAS7.0.0.15

    I don't find any other thinks about this error on trace of WAS (FFDC), even after activating trace Websphere, and i suspect compatbility between this version of hibernate and WAS7.0.0.15 ?
    Thinks advice,

    Rachid
    Hi,
    Based on this input, it would seem that the JTA transaction is either not present or not active. How are you specifying your transaction requirements? Since you are migrating from EJB2 to EJB3, are you aware that you need to specify your transaction requirements either via annotations or xml for your EJBs? I would try tracing WebSphere Transactions and the EJB Container to see what is happening based on your configuration.

    Good luck,
    Kevin Sutter, JPA Architect, IBM WebSphere