6 Replies Latest reply on Dec 22, 2001 8:08 AM by swatkat

    Sub-transactions in BMP throws Exception

    swatkat

      Hi,
      I am developing My application using BMP one of my Session bean method has around 5-6 bean (Entity and Session ) calls which form a long transaction with many sub-transactions in it.

      the code was working ok on earlier version of jboss that is JBoss 2.2.2 But now it fails with following exception

      2001-12-20 15:31:43,562 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackException, causedBy:
      javax.ejb.EJBException: Storing row for paymentId: e0010716~1008842503524 failed.
      at FIN.DataManagement.PaymentsDMBean.storePayment(PaymentsDMBean.java:175)
      at FIN.DataManagement.PaymentsDMBean.ejbStore(PaymentsDMBean.java:143)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.plugins.BMPPersistenceManager.storeEntity(BMPPersistenceManager.java:449)
      at org.jboss.ejb.EntityContainer.storeEntity(EntityContainer.java:630)
      at org.jboss.ejb.EntityContainer.synchronizeEntitiesWithinTransaction(EntityContainer.java:143)
      at org.jboss.ejb.EntityContainer.find(EntityContainer.java:581)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:896)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:221)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:131)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:80)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:98)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:155)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:55)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:102)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:109)
      at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:422)
      at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContainerInvoker.java:460)
      at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invokeHome(HomeProxy.java:236)
      at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomeProxy.java:181)
      at $Proxy146.findByPrimaryKey(Unknown Source)
      at FIN.ProblemDomain.AccountBean.getAccountName(AccountBean.java:747)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:568)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:67)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:155)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:64)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:127)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
      at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:279)
      at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:506)
      at org.jboss.ejb.plugins.jrmp.interfaces.GenericProxy.invokeContainer(GenericProxy.java:345)
      at org.jboss.ejb.plugins.jrmp.interfaces.StatelessSessionProxy.invoke(StatelessSessionProxy.java:122)
      at $Proxy104.getAccountName(Unknown Source)
      at FIN.ProblemDomain.PaymentsBean.addPayment(PaymentsBean.java:151)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:568)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:67)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:155)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:64)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:127)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
      at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:279)
      at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:506)
      at org.jboss.ejb.plugins.jrmp.interfaces.GenericProxy.invokeContainer(GenericProxy.java:345)
      at org.jboss.ejb.plugins.jrmp.interfaces.StatelessSessionProxy.invoke(StatelessSessionProxy.java:122)
      at $Proxy90.addPayment(Unknown Source)
      at FIN.UserInterface.AddInvoiceToCustomerUIServlet.invokeAddQuickInvoice(AddInvoiceToCustomerUIServlet.java:1920)
      at FIN.UserInterface.AddInvoiceToCustomerUIServlet.doGet(AddInvoiceToCustomerUIServlet.java:102)
      at FIN.UserInterface.AddInvoiceToCustomerUIServlet.doPost(AddInvoiceToCustomerUIServlet.java:136)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:289)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:541)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1145)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1099)
      at org.mortbay.http.HttpServer.service(HttpServer.java:725)
      at org.mortbay.http.HttpConnection.service(HttpConnection.java:745)
      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:918)
      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:760)
      at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:138)
      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:287)
      at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:715)
      at java.lang.Thread.run(Thread.java:484)
      2001-12-20 15:31:43,574 DEBUG [org.jboss.tm.TxCapsule] setRollbackOnly(): Entered, tx=XidImpl [FormatId=257, GlobalId=mirage.rspl//312, BranchQual=] status=STATUS_MARKED_ROLLBACK
      2001-12-20 15:31:43,575 DEBUG [org.jboss.tm.TxManager] suspended tx: TransactionImpl:XidImpl [FormatId=257, GlobalId=mirage.rspl//312, BranchQual=]
      2001-12-20 15:31:43,575 DEBUG [org.jboss.tm.TxManager] resumed tx: TransactionImpl:XidImpl [FormatId=257, GlobalId=mirage.rspl//312, BranchQual=]
      2001-12-20 15:31:43,575 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackException, causedBy:
      javax.transaction.TransactionRolledbackException: null
      Embedded Exception
      Storing row for paymentId: e0010716~1008842503524 failed.; nested exception is:
      javax.ejb.EJBException: null
      Embedded Exception
      Storing row for paymentId: e0010716~1008842503524 failed.
      javax.ejb.EJBException: null
      Embedded Exception
      Storing row for paymentId: e0010716~1008842503524 failed.
      at org.jboss.ejb.EntityContainer.synchronizeEntitiesWithinTransaction(EntityContainer.java:149)
      at org.jboss.ejb.EntityContainer.find(EntityContainer.java:581)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:896)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:221)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:131)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:80)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:98)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:155)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:55)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:102)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:109)
      at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:422)
      at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContainerInvoker.java:460)
      at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invokeHome(HomeProxy.java:236)
      at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomeProxy.java:181)
      at $Proxy146.findByPrimaryKey(Unknown Source)
      at FIN.ProblemDomain.AccountBean.getAccountName(AccountBean.java:747)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:568)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:67)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:155)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:64)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:127)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
      at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:279)
      at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:506)
      at org.jboss.ejb.plugins.jrmp.interfaces.GenericProxy.invokeContainer(GenericProxy.java:345)
      at org.jboss.ejb.plugins.jrmp.interfaces.StatelessSessionProxy.invoke(StatelessSessionProxy.java:122)
      at $Proxy104.getAccountName(Unknown Source)
      at FIN.ProblemDomain.PaymentsBean.addPayment(PaymentsBean.java:151)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:568)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:67)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:155)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:64)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:127)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
      at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:279)
      at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:506)
      at org.jboss.ejb.plugins.jrmp.interfaces.GenericProxy.invokeContainer(GenericProxy.java:345)
      at org.jboss.ejb.plugins.jrmp.interfaces.StatelessSessionProxy.invoke(StatelessSessionProxy.java:122)
      at $Proxy90.addPayment(Unknown Source)
      at FIN.UserInterface.AddInvoiceToCustomerUIServlet.invokeAddQuickInvoice(AddInvoiceToCustomerUIServlet.java:1920)
      at FIN.UserInterface.AddInvoiceToCustomerUIServlet.doGet(AddInvoiceToCustomerUIServlet.java:102)
      at FIN.UserInterface.AddInvoiceToCustomerUIServlet.doPost(AddInvoiceToCustomerUIServlet.java:136)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:289)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:541)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1145)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1099)
      at org.mortbay.http.HttpServer.service(HttpServer.java:725)
      at org.mortbay.http.HttpConnection.service(HttpConnection.java:745)
      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:918)
      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:760)
      at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:138)
      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:287)
      at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:715)
      at java.lang.Thread.run(Thread.java:484)
      javax.ejb.EJBException: Storing row for paymentId: e0010716~1008842503524 failed.
      at FIN.DataManagement.PaymentsDMBean.storePayment(PaymentsDMBean.java:175)
      at FIN.DataManagement.PaymentsDMBean.ejbStore(PaymentsDMBean.java:143)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.plugins.BMPPersistenceManager.storeEntity(BMPPersistenceManager.java:449)
      at org.jboss.ejb.EntityContainer.storeEntity(EntityContainer.java:630)
      at org.jboss.ejb.EntityContainer.synchronizeEntitiesWithinTransaction(EntityContainer.java:143)
      at org.jboss.ejb.EntityContainer.find(EntityContainer.java:581)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:896)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:221)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:131)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:80)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:98)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:155)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:55)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:102)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:109)
      at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:422)
      at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContainerInvoker.java:460)
      at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invokeHome(HomeProxy.java:236)
      at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomeProxy.java:181)
      at $Proxy146.findByPrimaryKey(Unknown Source)
      at FIN.ProblemDomain.AccountBean.getAccountName(AccountBean.java:747)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:568)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:67)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:155)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:64)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:127)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
      at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:279)
      at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:506)
      at org.jboss.ejb.plugins.jrmp.interfaces.GenericProxy.invokeContainer(GenericProxy.java:345)
      at org.jboss.ejb.plugins.jrmp.interfaces.StatelessSessionProxy.invoke(StatelessSessionProxy.java:122)
      at $Proxy104.getAccountName(Unknown Source)
      at FIN.ProblemDomain.PaymentsBean.addPayment(PaymentsBean.java:151)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:568)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:67)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:155)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:64)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:127)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
      at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:279)
      at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:506)
      at org.jboss.ejb.plugins.jrmp.interfaces.GenericProxy.invokeContainer(GenericProxy.java:345)
      at org.jboss.ejb.plugins.jrmp.interfaces.StatelessSessionProxy.invoke(StatelessSessionProxy.java:122)
      at $Proxy90.addPayment(Unknown Source)
      at FIN.UserInterface.AddInvoiceToCustomerUIServlet.invokeAddQuickInvoice(AddInvoiceToCustomerUIServlet.java:1920)
      at FIN.UserInterface.AddInvoiceToCustomerUIServlet.doGet(AddInvoiceToCustomerUIServlet.java:102)
      at FIN.UserInterface.AddInvoiceToCustomerUIServlet.doPost(AddInvoiceToCustomerUIServlet.java:136)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:289)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:541)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1145)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1099)
      at org.mortbay.http.HttpServer.service(HttpServer.java:725)
      at org.mortbay.http.HttpConnection.service(HttpConnection.java:745)
      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:918)
      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:760)
      at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:138)
      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:287)
      at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:715)
      at java.lang.Thread.run(Thread.java:484)
      2001-12-20 15:31:43,596 DEBUG [org.jboss.tm.TxCapsule] setRollbackOnly(): Entered, tx=XidImpl [FormatId=257, GlobalId=mirage.rspl//312, BranchQual=] status=STATUS_MARKED_ROLLBACK
      2001-12-20 15:31:43,597 DEBUG [org.jboss.tm.TxCapsule] rollback(): Entered, tx=XidImpl [FormatId=257, GlobalId=mirage.rspl//312, BranchQual=] status=STATUS_MARKED_ROLLBACK
      2001-12-20 15:31:43,601 INFO [Default] Error while Adding invoicejava.rmi.ServerException: null
      Embedded Exception
      Storing row for paymentId: e0010716~1008842503524 failed.; nested exception is:
      javax.ejb.EJBException: null
      Embedded Exception
      Storing row for paymentId: e0010716~1008842503524 failed.; nested exception is:
      javax.transaction.TransactionRolledbackException: null
      Embedded Exception
      Storing row for paymentId: e0010716~1008842503524 failed.; nested exception is:
      javax.ejb.EJBException: null
      Embedded Exception
      Storing row for paymentId: e0010716~1008842503524 failed.; nested exception is:
      javax.transaction.TransactionRolledbackException: null
      Embedded Exception
      Storing row for paymentId: e0010716~1008842503524 failed.; nested exception is:
      javax.ejb.EJBException: null
      Embedded Exception
      Storing row for paymentId: e0010716~1008842503524 failed.; nested exception is:
      javax.transaction.TransactionRolledbackException: null
      Embedded Exception
      Storing row for paymentId: e0010716~1008842503524 failed.; nested exception is:
      javax.ejb.EJBException: null
      Embedded Exception
      Storing row for paymentId: e0010716~1008842503524 failed.

      Strangly it works on previous versions. can any one help ?

      the postgres-service.xml database configuration looks like this :


      ConnectionURL=jdbc:postgresql://192.9.200.23:5432/e0010716 DriverClass=org.postgresql.Driver UserName=postgres Password=postgres
      e0010716
      java:/TransactionManager
      <mbean-ref name="ResourceAdapterName">JCA:service=RARDeployment,name=Minerva JDBC LocalTransaction ResourceAdapter</mbean-ref>
      <mbean-ref name="ConnectionManagerFactoryLoaderName">JCA:service=ConnectionManagerFactoryLoader,name=MinervaSharedLocalCMFactory</mbean-ref>
      # #Wed Aug 15 16:17:29 EDT 2001
      BlockingTimeoutMillis=50000 IdleTimeoutMinutes=3 MaxSize=10000 CleanupIntervalMinutes=2 MinSize=10
      MaxIdleTimeoutPercent=1.0
      org.jboss.resource.security.ManyToOnePrincipalMapping
      UserName=postgres

        • 1. Re: Sub-transactions in BMP throws Exception
          davidjencks

          What exactly do you mean by sub-transactions? Part of the transaction management contract for ejbs is that within a bean, within a method, you can only have one transaction at a time. If you need an independent transaction, you must make a "RequiresNew" call to another bean. There are no nested transactions.

          Your code might explain what you are trying to do best.

          • 2. Re: Sub-transactions in BMP throws Exception
            swatkat

            Well sorry for the misleading terminology i do mean Nested Transaction
            My call for the Bean method is like this

            SessionBeanFacade
            |
            |___ MethodAAAA() <-- Begin Main Transaction
            |
            |__ SessionBean2.Method1() <- Nest. Trans.
            |
            |__ SessionBean3.Method1() <- Nest. Trans.
            |
            |__ EntityBean4.ejbCreate() <- New Trans
            |
            |__ EntityBean4.ejbCreate() <- New Trans
            | <---- Fails at this point
            |__ EntityBean4.ejbCreate()
            |
            |____ MethodAAAA() Transaction Complete

            Why is this occuring. i would like to add..that it fails some times only.. not always

            Thanks

            • 3. Re: Sub-transactions in BMP throws Exception
              pazu

              I may be wrong, but AFAIK there is no support for nested transactions under the J2EE specification. All transactions are flat.

              • 4. Re: Sub-transactions in BMP throws Exception
                markd

                Could you post the transaction attributes of the Session Bean and Entity Beans involved? I'm guessing here, but I assume that you mean:

                SessionBeanFacade
                |
                |___ MethodAAAA() <-- TA: Requires
                |
                |__ SessionBean2.Method1() <- TA: Requires
                |
                |__ SessionBean3.Method1() <- TA: Requires
                |
                |__ EntityBean4.ejbCreate() <- TA: RequiresNew
                |
                |__ EntityBean4.ejbCreate() <- TA: RequiresNew
                | <---- Fails at this point
                |__ EntityBean4.ejbCreate()
                |
                |____ MethodAAAA() Transaction Complete

                If this is true, then you may not be handling the db connection correctly in your ejbStore() in EntityBean4.

                It would also help if you post code from PaymentsDMBean.java:175

                • 5. Re: Sub-transactions in BMP throws Exception
                  swatkat

                  public String ejbCreate(String bId, String paymentId, String docType, String docNum, String payeeAccountId, String payerAccountId,
                  String payeeName, double amount, String type, String memo, String date, boolean isPrinted)
                  throws CreateException, EJBException, RemoteException, SQLException {
                  try
                  {
                  makeConnection(bId);
                  }
                  catch (Exception e)
                  {
                  throw new EJBException("EjbCreate-Unable to connect to database " +e);
                  }
                  try
                  {
                  insertRow(paymentId, docType, docNum, payeeAccountId,
                  payerAccountId, payeeName, amount, type, memo, date, isPrinted);

                  }
                  catch (SQLException ex)
                  {
                  throw new EJBException("insert row in ejbCreate: " + ex);
                  }

                  this.paymentId = paymentId;
                  this.docType = docType;
                  this.docNum = docNum;
                  this.payeeAccountId = payeeAccountId;
                  this.payerAccountId = payerAccountId;
                  this.payeeName = payeeName;
                  this.amount = amount;
                  this.type = type;
                  this.memo = memo;
                  this.date = date;
                  this.isPrinted = isPrinted;
                  this.voided = false;

                  return paymentId;
                  }

                  public void insertRow(String paymentId, String docType, String docNum,
                  String payeeAccountId, String payerAccountId, String payeeName,
                  double amount, String type, String memo, String date, boolean isPrinted)
                  throws SQLException, RemoteException {

                  String insertStmt =
                  "insert into payments values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
                  PreparedStatement ps = con.prepareStatement(insertStmt);

                  ps.setString(1, paymentId);
                  ps.setString(2, docType);
                  ps.setString(3, docNum);
                  ps.setString(4, payeeAccountId);
                  ps.setString(5, payerAccountId);
                  ps.setString(6, payeeName);
                  ps.setDouble(7, amount);
                  ps.setString(8, type);
                  ps.setString(9, memo);
                  ps.setTimestamp(10, Timestamp.valueOf(date));
                  ps.setBoolean(11, isPrinted);
                  ps.setBoolean(12, false);

                  ps.executeUpdate();


                  try {
                  ps.close();
                  con.close();
                  } catch (SQLException se)
                  { }
                  }


                  The Makes a Connection object from the Connection pool :



                  private void makeConnection(String bId) throws SQLException, NamingException {

                  String s1 = "java:comp/env/jdbc/".concat(bId);
                  InitialContext ic = new InitialContext();
                  DataSource ds = (DataSource)ic.lookup(s1);
                  con = ds.getConnection();
                  }

                  • 6. Re: Sub-transactions in BMP throws Exception
                    swatkat

                    public void storePayment(String paymentId) throws SQLException {

                    //System.out.println("PaymentsDMBean:entering storePayment.. ");

                    String updateStmt = "update payments set doctype = ?, docnum = ?, " +
                    " payeeaccountid = ?, payeraccountid = ?, payeename = ?," +
                    " amount = ?, type = ?, memo= ?, date = ?, isprinted = ?, void = ? "+
                    " where paymentid = ?";

                    PreparedStatement ps = con.prepareStatement(updateStmt);

                    ps.setString(1, docType);
                    ps.setString(2, docNum);
                    ps.setString(3, payeeAccountId);
                    ps.setString(4, payerAccountId);
                    ps.setString(5, payeeName);
                    ps.setDouble(6, amount);
                    ps.setString(7, type);
                    ps.setString(8, memo);
                    ps.setTimestamp(9, Timestamp.valueOf(date));
                    ps.setBoolean(10, isPrinted);
                    ps.setBoolean(11, voided);
                    ps.setString(12, paymentId);

                    int rowCount = ps.executeUpdate();
                    if (rowCount == 0) {
                    throw new EJBException("Storing row for paymentId: " + paymentId + " failed.");
                    }
                    try {
                    ps.close();
                    con.close();
                    } catch (SQLException e)
                    { }

                    //System.out.println("PaymentsDMBean:exiting storePayment.. ");
                    }