Explicit Transaction Management not working

Hi,
I have written a StatelessSession Bean. There is a method in this bean which
calls methods of Other BMP Beans.All these methods have to be part of one Transaction.Below
I have shown in Pseudocode ,how I am handling it.
//This is the SessionBean Method
public void processDocument()
UserTransaction Utrx = SessionContext.getUserTransaction();
try
Utrx.begin();
Bean1.method1();//this method inserts a row in the database
Bean2.method2();// this method inserts a row in another table
Bean3.method3();//deletes a row
// couple of other method calls
Utrx.commit();
catch()
//catch Exceptions and rollback.

OK, now I'm catching up. Do you see that exception thrown in your calling
code, i.e. does your code as posted catch that exception?
If so, you most probably are not using the proper connection pool -- you
should be using the JTS pool not just a WL pool -- and so the connection is
not participating in the transaction.
Peace,
Cameron Purdy
Tangosol Inc.
Tangosol Coherence: Clustered Coherent Cache for J2EE
Information at http://www.tangosol.com/
"Sunil Naik" <[email protected]> wrote in message
news:3c26a505$[email protected]..
>
"Cameron Purdy" <[email protected]> wrote:
Why do you say it is not working? Do you get a compile error? An
exception?
A partial commit? Deadlock? Horse head in your bed? Out of memory?
Peace,
Hi Cameron,
Actually , while testing the method ,I am deliberately making the3 rd
method call throw an Exception and exit.In that case what I expect is thatthe
work done in the first two method calls should be rolled back. i.e.Therows should
not be inserted in the database.This is not happening.The inserts made inthe
earlier two methods are being commited.
Hope it is clear now.
Thanx,
sunil
Cameron Purdy
Tangosol Inc.
Tangosol Coherence: Clustered Coherent Cache for J2EE
Information at http://www.tangosol.com/
"Sunil Naik" <[email protected]> wrote in message
news:3c230f17$[email protected]..
Hi,
I have written a StatelessSession Bean. There is a method in thisbean
which
calls methods of Other BMP Beans.All these methods have to be partof one
Transaction.Below
I have shown in Pseudocode ,how I am handling it.
//This is the SessionBean Method
public void processDocument()
UserTransaction Utrx = SessionContext.getUserTransaction();
try
Utrx.begin();
Bean1.method1();//this method inserts a row in the database
Bean2.method2();// this method inserts a row in another table
Bean3.method3();//deletes a row
// couple of other method calls
Utrx.commit();
catch()
//catch Exceptions and rollback.

Similar Messages

  • Java user-defined transaction management not working correctly???

    Hi everyone,
    I have encountered a problem when using Java user-defined transaction management in my session bean. It threw an exception but I could not work out what that means. Could anyone comment on this? Thanks.
    This BrokerBean is a stateless session calling other entities bean to perform some simple operations. There are 2 Cloudscape databases in use. Invoices (EB) use InvoiceDB and all the other EBs use StockDB.
    If I comment out the user-defined transaction management code, then everything works fine. Or if I comment out the Invoices EB code, it is fine as well. It seemed to me that there is something wrong in transaction management when dealing with distributed databases.
    --------------- source code ----------------------
    public void CreateInvoices(int sub_accno) {
    try {
    utx = context.getUserTransaction();
    utx.begin();
    SubAcc subAcc = subAccHome.findByPrimaryKey(new SubAccPK(sub_accno));
    String sub_name = subAcc.getSubName();
    String sub_address = subAcc.getSubAddress();
    Collection c = stockTransHome.findBySubAccno(sub_accno);
    Iterator i = c.iterator();
    ArrayList a = new ArrayList();
    while (i.hasNext()) {
    StockTrans stockTrans = (StockTrans)i.next();
    int trans_id = stockTrans.getTransID();
    String tran_type = stockTrans.getTranType();
    int stock_id = stockTrans.getStockID();
    float price = stockTrans.getPrice();
    Invoices invoices = invoicesHome.create(sub_accno, sub_name, sub_address, trans_id, stock_id, tran_type, price);
    stockTrans = stockTransHome.findByPrimaryKey(new StockTransPK(trans_id));
    stockTrans.remove();
    utx.commit();
    utx = null;
    } catch (Exception e) {
    if (utx != null) {
    try {
    utx.rollback();
    utx = null;
    catch (Exception ex) {}
    // e.printStackTrace();
    throw new EJBException("BrokerBean.CreateInvoices(): " + e.getMessage());
    --------------- exception ----------------------
    Initiating login ...
    Enter Username:
    Enter Password:
    Binding name:`java:comp/env/ejb/BrokerSB`
    EJB test succeed
    Test BuyStock!
    Test BuyStock!
    Test BuyStock!
    Test BuyStock!
    Test SellStock!
    Test SellStock!
    Caught an exception.
    java.rmi.ServerException: RemoteException occurred in server thread; nested exce
    ption is:
    java.rmi.RemoteException: BrokerBean.CreateInvoices(): CORBA TRANSACTION
    _ROLLEDBACK 9998 Maybe; nested exception is:
    org.omg.CORBA.TRANSACTION_ROLLEDBACK: vmcid: 0x2000 minor code: 1806
    completed: Maybe
    at com.sun.corba.ee.internal.iiop.ShutdownUtilDelegate.mapSystemExceptio
    n(ShutdownUtilDelegate.java:64)
    at javax.rmi.CORBA.Util.mapSystemException(Util.java:65)
    at BrokerStub.CreateInvoices(Unknown Source)
    at Client.main(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:22
    9)
    at com.sun.enterprise.appclient.Main.main(Main.java:155)
    Caused by: java.rmi.RemoteException: BrokerBean.CreateInvoices(): CORBA TRANSACT
    ION_ROLLEDBACK 9998 Maybe; nested exception is:
    org.omg.CORBA.TRANSACTION_ROLLEDBACK: vmcid: 0x2000 minor code: 1806
    completed: Maybe
    at com.sun.enterprise.iiop.POAProtocolMgr.mapException(POAProtocolMgr.ja
    va:389)
    at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:43
    1)
    at BrokerBean_EJBObjectImpl.CreateInvoices(BrokerBean_EJBObjectImpl.java
    :265)
    at BrokerBeanEJBObjectImpl_Tie._invoke(Unknown Source)
    at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatchToServant(Ge
    nericPOAServerSC.java:520)
    at com.sun.corba.ee.internal.POA.GenericPOAServerSC.internalDispatch(Gen
    ericPOAServerSC.java:210)
    at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatch(GenericPOAS
    erverSC.java:112)
    at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:255)
    at com.sun.corba.ee.internal.iiop.RequestProcessor.process(RequestProces
    sor.java:84)
    at com.sun.corba.ee.internal.orbutil.ThreadPool$PooledThread.run(ThreadP
    ool.java:99)

    Three things:
    first, maybe you should think of putting ut.begin() just before the invoicesHome.create() method and ut.commit() just after the stockTrans.remove() method.It wont solve the current problem but will help in performance once the problem is solved.
    second, your utx.commit() is outside the try block. how come the code is compiling then??
    third, try doing a SOP call before and after invoicesHome.create() method and see where the problem actually lies.
    let us know...
    Hi SteveW2,
    Thanks for being so helpful. Here are my replies:
    Can I just ask why you're not using containermanaged
    transactions?The reason why I didn't use container managed
    transactions is because I don't really know how to do
    that. I am more familiar with this user-defined
    transaction handling.
    I have attempted to implement the same method in an
    entity bean and just let the container manage the
    rollback itself. The same exception was thrown when
    running the client.
    Also, the transaction behaviour is likely to relateto
    the app server youre using - which is it?What do you mean by the app server? I am using J2EE
    1.3.1 if that is what you meant.
    Finally, if your code has a problem rolling back,and
    throws an exception, you discard your exception
    thereby losing useful information.I have tried to print the exception stack as well, but
    it is the same as just printing the general
    exception.
    This problem is very strange cause if I comment out
    the transaction management thing, then everything
    works fine. Or if I am only working with 1 single
    database, with this user-defined transaction handling,
    everything works fine as well.
    Here is the error log from J2EE server if you are
    interested.
    ------------ error log ---------------
    javax.ejb.TransactionRolledbackLocalException:
    Exception thrown from bean; nested exception is:
    javax.ejb.EJBException: ejbCreate: Connection
    previously closed, open another Connection
    javax.ejb.EJBException: ejbCreate: Connection
    previously closed, open another Connection
         at InvoicesBean.ejbCreate(Unknown Source)
    at
    InvoicesBean_RemoteHomeImpl.create(InvoicesBean_Remote
    omeImpl.java:31)
         at InvoicesHomeStub.create(Unknown Source)
         at BrokerBean.CreateInvoices(Unknown Source)
    at
    BrokerBean_EJBObjectImpl.CreateInvoices(BrokerBean_EJB
    bjectImpl.java:261)
    at BrokerBeanEJBObjectImpl_Tie._invoke(Unknown
    Source)
    at
    com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispa
    chToServant(GenericPOAServerSC.java:520)
    at
    com.sun.corba.ee.internal.POA.GenericPOAServerSC.inter
    alDispatch(GenericPOAServerSC.java:210)
    at
    com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispa
    ch(GenericPOAServerSC.java:112)
    at
    com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:25
    at
    com.sun.corba.ee.internal.iiop.RequestProcessor.proces
    (RequestProcessor.java:84)
    at
    com.sun.corba.ee.internal.orbutil.ThreadPool$PooledThr
    ad.run(ThreadPool.java:99)
    javax.ejb.TransactionRolledbackLocalException:
    Exception thrown from bean; nested exception is:
    javax.ejb.EJBException: ejbCreate: Connection
    previously closed, open another Connection
    at
    com.sun.ejb.containers.BaseContainer.checkExceptionCli
    ntTx(BaseContainer.java:1434)
    at
    com.sun.ejb.containers.BaseContainer.postInvokeTx(Base
    ontainer.java:1294)
    at
    com.sun.ejb.containers.BaseContainer.postInvoke(BaseCo
    tainer.java:403)
    at
    InvoicesBean_RemoteHomeImpl.create(InvoicesBean_Remote
    omeImpl.java:37)
         at InvoicesHomeStub.create(Unknown Source)
         at BrokerBean.CreateInvoices(Unknown Source)
    at
    BrokerBean_EJBObjectImpl.CreateInvoices(BrokerBean_EJB
    bjectImpl.java:261)
    at BrokerBeanEJBObjectImpl_Tie._invoke(Unknown
    Source)
    at
    com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispa
    chToServant(GenericPOAServerSC.java:520)
    at
    com.sun.corba.ee.internal.POA.GenericPOAServerSC.inter
    alDispatch(GenericPOAServerSC.java:210)
    at
    com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispa
    ch(GenericPOAServerSC.java:112)
    at
    com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:25
    at
    com.sun.corba.ee.internal.iiop.RequestProcessor.proces
    (RequestProcessor.java:84)
    at
    com.sun.corba.ee.internal.orbutil.ThreadPool$PooledThr
    ad.run(ThreadPool.java:99)
    What is "connection previously closed, open another
    connection"? This might be the cause of the
    exception.
    I'll keep trying till I solve the problem.
    Thanks,
    Sasuke

  • Password Manager not working with any internet browsers

    I have Thinkvantage password manager installed (v. 3.20.0311.00) on my Thinkpad X201. I am running Windows 7 professional, 64 bit. Password Manager works for all programs except IE8 or Mozilla Firefox (eg. works for Outlook, works for iTunes, etc.). When browsing, the program simply never pops up. It worked previously, and I still have many saved website login details, but it never logs in for me any more and new sites do not activate the program.
    I have made sure that the add-on is enabled and I have checked the box next to "enable 3rd party browser extensions" in the advanced tab of internet options. I have also tried resetting internet explorer settings. As mentioned above, this in not only a problem with IE8; it also occurs with Firefox.
    Any help would be very much appreciated.
    Dr_Rap

    Same problem here. I just recieved mine (Win 7 pro 64 bit, X201 Multitouch) last week and password manager not working at all in ANY web browser. It recorded my .net password just fine, but i can't get it to work in IE8. Who pays this kind of money for something that doesnt work?
    Fix this Lenovo!

  • Password manager not work on new Chrome

    Hi!
    Chrome version 29.0.1547.57m. Password Manager not working...

    We notice password manager is broken by new chrome. 
    Dev is working on fix, please wait for new release of Password Manager to fix this issue.

  • Kaspersky password manager not working on fox 5

    kaspersky password manager not working on the new firefox 5

    Kasperski has finally released a patch that works fine with Firefox 4, 5 and 6, as well as with Google Chrome!!!!
    You can download the patch at the URL [http://support.kaspersky.com/faq/?qid=208284589 Firefox patch for Kaspersky Password Manager]
    You must follow the entire procedure as described by the Kasperski techs... I just tried it, as I had the same problem as you, and it works fine!!!!

  • After the updating firefox 5.0 the internet download manager not working (not compatible) can you explan why?

    After the updating fire fox 5.0 the internet download manager not working (not compatible) can you explain why?

    Add-on developers need to keep up with new versions of Firefox as they are released and update their product. Have you checked with IDM to see if they have an update for you to install? Or ask them when they are going to have an update ready for 5.0.
    Another thing you could do is to install FlashGot. <br />
    https://addons.mozilla.org/en-US/firefox/addon/flashgot/ <br />
    http://flashgot.net/ <br />
    The developer of Flashgot, Giorgio Maone, keeps his extensions compatible with versions of Firefox that are still in development - future release versions.

  • W7 64 BIT Password Manager not working

    Using CSS 8.3. Can use fingerprint to log into W7. But the Password Manager feature will no longer work.
    Known issue?
    I'm also dual booting with Vista 32 bit. In Vista it works fine. Could the problem be one BIOS chip since its hardware connected (I think) but 2 OS'?

    Same problem here. I just recieved mine (Win 7 pro 64 bit, X201 Multitouch) last week and password manager not working at all in ANY web browser. It recorded my .net password just fine, but i can't get it to work in IE8. Who pays this kind of money for something that doesnt work?
    Fix this Lenovo!

  • Hp file manager not working

    after updating hp slate 7voice tab from jellybean to kitkat the hp file manager not working.

    Hello, and Welcome to the HP Support Community!
    This is not HP's fault - this change was caused by Google.
    Perhaps this article can help explain how Google changed Android KitKat 4.4:
    KitKat and SD cards — what's fixed, what's broken and what's misunderstood.
    WyreNut
    I am a Volunteer here, not employed by HP.
    You too can become an HP Expert! Details HERE!
    If my post has helped you, click the Kudos Thumbs up!
    If it solved your issue, Click the "Accept as Solution" button so others can benefit from the question you asked!

  • Internet Download manager not working.

    Internet Download manager not working with latest version of Firefox.
    My Firefox keeps crashing regularly as wee. Any suggestions how to fix these two problems.

    Can you confirm the version of Firefox you're using? The information in this post suggests you're using Firefox 19. The latest version is 35.0.1.

  • Weblogic Explicit Transaction Management

    Hi,
    I am in need of managing mutiple transactions which access two different databases which are not Oracle (NON XA) but still I want to implement 2 Phase Commit.
    I read documents about JTA, and tried to use TransactionManager . But I am not able to create a XaResource with my weblogic JNDI lookup. It is just return a type cast exception saying not able to convert form RmiDataSource to XaDataSource. Transaction class's enlistResource() method only accepts XaReource. Can you suggest a solution for acheving mutiple database transactions to be commited or rolledback as per need. In shot how to manage transactions explicitly in Weblogic 10.

    OK, now I'm catching up. Do you see that exception thrown in your calling
    code, i.e. does your code as posted catch that exception?
    If so, you most probably are not using the proper connection pool -- you
    should be using the JTS pool not just a WL pool -- and so the connection is
    not participating in the transaction.
    Peace,
    Cameron Purdy
    Tangosol Inc.
    Tangosol Coherence: Clustered Coherent Cache for J2EE
    Information at http://www.tangosol.com/
    "Sunil Naik" <[email protected]> wrote in message
    news:3c26a505$[email protected]..
    >
    "Cameron Purdy" <[email protected]> wrote:
    Why do you say it is not working? Do you get a compile error? An
    exception?
    A partial commit? Deadlock? Horse head in your bed? Out of memory?
    Peace,
    Hi Cameron,
    Actually , while testing the method ,I am deliberately making the3 rd
    method call throw an Exception and exit.In that case what I expect is thatthe
    work done in the first two method calls should be rolled back. i.e.Therows should
    not be inserted in the database.This is not happening.The inserts made inthe
    earlier two methods are being commited.
    Hope it is clear now.
    Thanx,
    sunil
    Cameron Purdy
    Tangosol Inc.
    Tangosol Coherence: Clustered Coherent Cache for J2EE
    Information at http://www.tangosol.com/
    "Sunil Naik" <[email protected]> wrote in message
    news:3c230f17$[email protected]..
    Hi,
    I have written a StatelessSession Bean. There is a method in thisbean
    which
    calls methods of Other BMP Beans.All these methods have to be partof one
    Transaction.Below
    I have shown in Pseudocode ,how I am handling it.
    //This is the SessionBean Method
    public void processDocument()
    UserTransaction Utrx = SessionContext.getUserTransaction();
    try
    Utrx.begin();
    Bean1.method1();//this method inserts a row in the database
    Bean2.method2();// this method inserts a row in another table
    Bean3.method3();//deletes a row
    // couple of other method calls
    Utrx.commit();
    catch()
    //catch Exceptions and rollback.

  • EJB Transaction does not work

    Hi,
    I have a servlet, a session bean, and an entity bean. A servlet doesn't have any transaction attribute, a session bean has Required, and an entity bean has Required. I have the code like the following:
    Servlet:
    EJBDelegate ed = new EJBDelegate();
    TwoPhaseSB sb = ed.getTwoPhaseSB();
    sb.testTransaction();Session Bean:
    public void testTransaction() {
        try{
            TestInfoLocal testInfo;
            TestInfoLocalHome testInfoHome = TestInfoUtil.getLocalHome();
            testInfo = testInfoHome.create("525252", "353535", "transaction test insert", "etc");
            testInfo.setElement_id("111111");
            //There's no item which has its primary key as 7777, so there's exception error occurs   
            testInfo = testInfoHome.findByPrimaryKey(new Integer(7777));
        }catch(Exception e){
             e.printStackTrace();
    }Since the code in testTransaction is supposed to run in the same transaction, if there's exception occurrs, isn't it supposed to rollback? I mean, creation of item and update should be rollback. But, the data is inserted and created although there's exception. Could anyone can give me the idea why transaction doesn't work? FYI, I'm using Weblogic8.1.

    Yes, you're right. I am using CMP. I added the following exceptions to my session bean but still the changes are updated:
         }catch(EJBException e){     
              e.printStackTrace();
         }catch (NamingException e) {
              e.printStackTrace();
         }catch (CreateException e) {
              e.printStackTrace();
         }catch (FinderException e) {
              e.printStackTrace();
         } I tried to insert "TransactionRolledbackException", but it's not thrown in any statement since my beans are managed by container. Could you tell me what exception should I use? Or should I add some exception to my entity bean? Finder methods are throwing FinderException currently.
    Thanks,

  • Profile manager not working? iOS 6

    I have mac mini working as Mountain Lion Server 10.8.2, Server.app 2.1 (upgraded from 10.7.4 Server)
    (All services are using 3rd party ssl certificates)
    previously enrolled devices are getting push changes.
    I got a new iphone 4 (service upgrade) with ios6, and when i enroll it, it gets a name: New Device in profile manager
    Not the name that it has been named. And the push settings arent pushed. Other devices do get changes.
    I got the right name for the iphone to profile manager, by filling the data as a place holder device. Then it got the
    right name for the device. But push payloads are not working.

    the device logs gets 500 error code, you van see this in iphone configuration utility or in apple configurator.
    as follows in console:
    "US Desc: A transaction with the server at “https://server.com/devicemanagement/api/device/connect” has failed with the status “500”.
    Domain : MCHTTPTransactionErrorDomain
    Code   : 23001
    Type   : MCFatalError

  • Application Manager not working

    For some reason my Application Manager and my Adobe Premiere CC 2014 are not working at all.
    I hava an iMac 3.4 GHz Intel Core i7 with 24 GB 1600 MHz DDR3 ram and running OSX 10.9.5.
    No matter how many times I try to load my new apps in Application Manager it will not reload (internet is fine).
    Adobe Premiere CC 2014 will not play clips or audio (at all).

    This is an open forum, not Adobe support... you need Adobe staff support to help
    Adobe contact information - http://helpx.adobe.com/contact.html
    -Select your product and what you need help with
    -Click on the blue box "Still need help? Contact us"

  • Application manager not working why?

    My application manager is not working and I dont know how to reinstall it, Help please

    Please check:
    Adobe - Adobe Application Manager : For Windows : Adobe Application Manager
    Get Adobe Creative Cloud Desktop App & Adobe Application Manager
    Adobe - Adobe Application Manager : For Macintosh
    Let us know if it helped.
    Regards
    Rajshree

  • After upgrade from 10.2.0.1 to 10.2.0.4 enterprise manager not working

    after upgrade from 10.2.0.1 to 10.2.0.4
    on windows enterprise manager is not working
    Edited by: 830525 on Mar 24, 2012 9:44 AM

    F:\Documents and Settings\hakem>emctl start dbconsole
    Oracle Enterprise Manager 10g Database Control Release 10.2.0.4.0
    Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
    https://M1C3:1158/em/console/aboutApplication
    Starting Oracle Enterprise Manager 10g Database Control ...The OracleDBConsoleor
    cl service is starting..........................................................
    The OracleDBConsoleorcl service could not be started.
    A service specific error occurred: 1.
    More help is available by typing NET HELPMSG 3547.
    F:\Documents and Settings\hakem>NET HELPMSG 3547
    A service specific error occurred: ***.
    EXPLANATION
    A service-specific error occurred.
    ACTION
    Refer to the Help or documentation for that service to determine the problem.
    that's what happen while trying to start db console

Maybe you are looking for

  • Excise Duty is not getting in Net Value

    Dear All Sales order, in condition tab  system is calculating Excise and CST. but in Net Value, its displaying Base price only But our requirement is Base price + excise + ecess in Net Value Plz suggest Regards Arun

  • Push email (MS exchange) works intermittently after upgrade to ios 5.1 and ios 5.1.1

    I have an iphone 4 with my office email (MS exchange) account configured. Other accounts are Gmail & iCloud. Office email is configured as Push, Gmail as Fetch and iCloud as Push. Till ios 5.0.x everything was fine. Office emails were getting pushed

  • AMD Troubleshooting guide! UpToDate version in VIA forum.

    [size=11](Revision 4-9-2003)[/SIZE]   Hi there, Follow everything on the list, even if it doesn't look like it would solve your problem, most problems are created somewhere else! To give some examples: CPU won't run FSB133....mostly powersupply or CP

  • My iPod touch 4th generation won't backup to my computer?

    When I connect with iTunes or try to manually backup my iPod touch with iTunes onto my computer I get a message pop up saying 'iTunes could not back up the iPod "Anastasia's" because the backup was corrupt or not compatible with the iPod. Delete the

  • Itunes window does not open

    running itunes 8 on 2.4ghz osx 10.5.5 imac. when i open itunes the application opens but the window does not nor can i get it to open. when i initially click on itunes to open it the curser blips to the opening egg timer for about 1 quarter second bu