Discussions

EJB programming & troubleshooting: Transaction Problem in Weblogic

  1. Transaction Problem in Weblogic (3 messages)

    Hi

    I am using Container Managed Transaction. I have a SessionBean(SB) calling EntityBean1(EB1) and EntityBean2(EB2).

    Case 1:
    I set the transaction attribute for SB=Required, EB1=Required and EB2=RequiredNew.
    I monitor the transaction through weblogic console, the transaction rollback in EB1 and SB. I suppose failure in EB2 will not affect EB1, but it did. Why?

    Case 2:
    I set the transaction attribute for SB=NotSupported, EB1=NotSupported and EB2=RequiredNew.
    I monitor the transaction through weblogic console, why weblogic still create the transaction for SB and EB1 eventhough I set it to NotSupported?


    Last question:
    I need to enable distributed transaction(2-PC) by connecting to 2 different databases. But from what I had read, it seem like I cannot do it through Container-Managed Transaction. I can only use 2-PC by using Bean-Managed Transaction. Is this true?

    Please advice

    Cheers
    Ray

    Threaded Messages (3)

  2. Transaction Problem in Weblogic[ Go to top ]

    Case 1:
    The transaction in EJB2 is separate from the transaction in the SSB and EJB1 and the former should not affect the latter.

    Case 2:
    WebLogic always starts a local transaction internally in this case.

    Case 3:
    You can do this with CMP if you use XA-compliant drivers in the Connection Pools and if you use a TXDataSource to remove the connections from the XA-compliant pools.

    Bill
  3. Transaction Problem in Weblogic[ Go to top ]

    Thanks for ur reply.

    Case 1:
    Yes, theoretically EB2 shoudn't affect SB, but failure in EB2 did affect SB. why does this happen?
    I suppose EJB does not support Nested Transaction, in other word, RequiresNew doesn't bring meaning to this scenerio. Am I right?

    Case 2:
    I read the document in Weblogic Edocs, it specified that weblogic by default using Support as transaction attribute. How can it start transaction internally?

    Case 3:
    Just to double confirm with u, do u means that I still can use Container-Managed Tx by using XA driver and TX Datasource?

    Please advice.

    Ray
  4. Transaction Problem in Weblogic[ Go to top ]

    Hi,

    <quote>
    Case 1:
    Yes, theoretically EB2 shoudn't affect SB, but failure in EB2 did affect SB. why does this happen?
    </quote>

    It shouldn't and doesn't unless you have some type of application logic problem. If it does, you should submit a test case that verifies this to BEA Support. Check your logic and make sure you are using TXDataSources.

    <quote>
    Case 2:
    I read the document in Weblogic Edocs, it specified that weblogic by default using Support as transaction attribute. How can it start transaction internally?
    </quote>

    From the ejb2.0 spec, Section 17.6.2.1:

    "The Container invokes an enterprise Bean method whose transaction attribute is set to NotSupported
    with an unspecified transaction context."

    Unspecified means, well, unspecified. So vendors are free to do what they will.

    Case 3:

    True. Actually, 2 pools with XA-drivers and 2 TXDataSources.

    Bill