EJB programming & troubleshooting: Weblogic 6.1 Heuristic Mixed Exception if database commit failes

  1. Hi there,

    we just experienced some strange problem with transaction handling using BEA Weblogic 6.1 SP2.

    In order to ensure that there would be no inconsistencies in our application after a database crash, we implemented a test which includes a hard (manual) database shutdown.

    Test behavior:
    1.) activate breakpoint in TX method
    2.) call to SLSB method with TX=Required with break point in source code right before the leaving the TX metohd, which causes the method to wait.
    3.) shutdown (abort) oracle dbms
    4.) deactivate break point

    The Entity Bean which is used in this test is running in exclusive lock mode.

    We expected the transaction to be rolled back, since the AppServer is not able to commit the transaction in the dbms, i.e., the database and the Entity Bean within the AppServer Cache would contain the "old" values.

    Unfortunately that's not what happens ...
    This test produces an HeuristicMixedException, which does neither cause the transaction to be rolled back, nor the Entity Bean in cache to be invalidated. This is exactly one of the inconsistencies we want to avoid 8-((.

    We've already tried to find some ideas in the weblogic Documentation, but it contains not very much about HeuristicMixedException.

    Here's a stack trace of the occured Exception, which might be useful:
    ####<17.07.2003 10:30:30 CEST> <Error> <JTA> <PC33360.eg.deutsche-boerse.de> <myserver> <
    ExecuteThread: '68' for queue: 'default'> <Doerr> <14799:b59a46407f28edb9> <000000> <Name
    =[EJB com.entory.bondserver.server.facade.BondServerAdminServerBean.changeBondTx(com.ento
    itted,HeuristicErrorCode=XA_HEURHAZ,numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds sin
    ce begin=42,seconds left=120,activeThread=Thread[ExecuteThread: '68' for queue: 'default'
    ,5,Thread Group for Queue: 'default'],ServerResourceInfo[weblogic.jdbc.jts.Connection]=(s
    ({ISOLATION LEVEL=2, weblogic.transaction.name=[EJB com.entory.bondserver.server.facade.B
    scriptor=(CoordinatorURL=myserver+, Resources={})],CoordinatorURL
    =myserver+ completed heuristically:
    (weblogic.jdbc.jts.Connection, HeuristicHazard, (javax.transaction.xa.XAException: Keine
    weiteren Daten aus Socket zu lesen)) >
    ####<17.07.2003 10:30:30 CEST> <Error> <EJB> <PC33360.eg.deutsche-boerse.de> <myserver> <
    ExecuteThread: '68' for queue: 'default'> <Doerr> <> <010026> <Exception during commit of
     transaction Name=[EJB com.entory.bondserver.server.facade.BondServerAdminServerBean.chan
    ers=0,seconds since begin=42,seconds left=120,ServerResourceInfo[weblogic.jdbc.jts.Connec
    perties=({ISOLATION LEVEL=2, weblogic.transaction.name=[EJB com.entory.bondserver.server.
    ndVOC)], weblogic.jdbc=t3://}),OwnerTransactionManager=ServerTM[ServerCoord
    inatorDescriptor=(CoordinatorURL=myserver+, Resources={})],Coordi
    natorURL=myserver+ javax.transaction.HeuristicMixedException: (
    weblogic.jdbc.jts.Connection, HeuristicHazard, (javax.transaction.xa.XAException: Keine w
    eiteren Daten aus Socket zu lesen))
            at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTrans
            at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionIm
            at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:231)
            at com.entory.bondserver.server.facade.BondServerAdminServerBean_jb10eq_EOImpl.ch
            at com.entory.bondserver.server.facade.BondServerAdminServerBean.changeBond(BondS

    I would much appreciate some help 8-)
  2. Are you using Oracle's JDBC driver?

    Or are you using BEA's Oracle JDBC driver?

    Did you read this FAQ?

  3. Hi Sean,

    we're using Oracle JDBC Thin Driver (V8.1.7).

    I've partially read this FAQ, but to be honest, I don't fully understand it. I found the comment, which says that 8.1.6 driver has a bug, and "we" (bea?) build a workaround for 8.1.7 which could be avoided by using XA Connection pool.

    But we don't use distributed transactions explicitly. As described in example, we just amend some values in the entity bean, and ensure that the changes could not be committed to the database. From my point of view, the resources involved, are the database and the entity cache of the ejb container, so I don't know what could be wrong.
  4. we just found the cause of the problem.

    We had set <delay-updates-until-end-of-tx>true</delay-updates-until-end-of-tx> in weblogic-ejb-jar.xml for this entity bean.
    Setting this parameter to false (which is the default value) solves the problem.

    Why this results in an HeuristicMixedException is not really clear to me, but I'm glad it works now.

    Thanks a lot for your help anyway !

    Btw.: If there is anyone with an explanation for this behavior, I'd really appreciate to hear it 8-).