0 Replies Latest reply on Mar 25, 2004 10:36 AM by bc2002

    Problems with transaction.

    bc2002 Newbie

      I am testing BMP with Jboss. And I ran into transaction problems that I could not find any similar info on Google. I am using Hibernate 2, jboss 3.2.3 and postgresql 7.3. I am new to Hibernate/Jboss and I have no clue how to handle the error.

      07:04:05,015 ERROR [LogInterceptor] TransactionRolledbackException in method: public abstract com.ejb.interfaces.Tuser com.ejb.interfaces.TuserHome.create(com.ejb.dto.TuserData) throws javax.ejb.CreateException,java.rmi.RemoteException, causedBy:
      org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=bc2002.local//25, BranchQual=] status=STATUS_NO_TRANSACTION; - nested throwable: (javax.ejb.EJBException: null; CausedByException is:
      null)
      at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:413)
      at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:398)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:277)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:98)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:92)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:120)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
      at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:483)
      at org.jboss.ejb.Container.invoke(Container.java:720)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:367)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:552)
      Caused by: javax.ejb.EJBException: null; CausedByException is:
      null
      at org.jboss.ejb.plugins.BMPPersistenceManager.storeEntity(BMPPersistenceManager.java:475)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.storeEntity(CachedConnectionInterceptor.java:387)
      at org.jboss.ejb.EntityContainer.storeEntity(EntityContainer.java:714)
      at org.jboss.ejb.GlobalTxEntityMap.synchronizeEntities(GlobalTxEntityMap.java:149)
      at org.jboss.ejb.GlobalTxEntityMap$GlobalTxEntityMapSynchronize.beforeCompletion(GlobalTxEntityMap.java:215)
      at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1308)
      at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:347)
      ... 26 more


      And this is the transaction attribute in ejb-jar

      <assembly-descriptor>
      <container-transaction>

      <ejb-name>TuserBMP</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>*</method-name>


      <ejb-name>TuserBMP</ejb-name>
      <method-intf>Remote</method-intf>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      </assembly-descriptor>

      And this is the code for saving using hibernate

      session = sessionFactory.openSession();
      transaction = session.beginTransaction();
      session.save(anUser, anUser.getUserid());
      transaction.commit();
      session.close();


      I appreciate any glimpse of light that can show the way.


      thanks

      bc2002