11 Replies Latest reply: Jan 14, 2010 10:18 AM by Mark Little RSS

HeuristicMixedException for XA transaction between JBoss 5.1.0GA and 4.1.24

Michael Wiezik Newbie

Hi All,

 

I am trying to migrate from JBoss 3.2.0 to 5.1.0GA. The application running on the server is invoking remotely EJBs deployed on yet another jboss 3.2.0. When I start JBoss 5.1.0.GA, I can see the following logs:

 

        javax.transaction.HeuristicMixedException

javax.transaction.HeuristicMixedException

        at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commit(TransactionImple.java:254)

        at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:501)

        at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:361)

        at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)

        at org.jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:267)

        at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:211)

        at org.jboss.ejb.plugins.security.PreSecurityInterceptor.process(PreSecurityInterceptor.java:134)

        at org.jboss.ejb.plugins.security.PreSecurityInterceptor.invoke(PreSecurityInterceptor.java:81)

        at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)

        at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)

        at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:650)

        at org.jboss.ejb.Container.invoke(Container.java:1029)

        at sun.reflect.GeneratedMethodAccessor356.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

        at java.lang.reflect.Method.invoke(Method.java:597)

        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)

        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)

     ...

 

13:42:41,888 WARN  [loggerI18N] [com.arjuna.ats.internal.jta.resources.arjunacore.norecoveryxa] [com.arjuna.ats.internal.jta.resources.arjunacore.norecoveryxa] Could not find new XAResource to use for recoverin

g non-serializable XAResource < 131075, 26, 24, 49459748495454985158101574958529851985651100485850575797484954549851581015749585298519856511004858509750 >

 

 

Any clues will be appreciated. Thanks!

 

Michael Wiezik

  • 1. Re: HeuristicMixedException for XA transaction between JBoss 5.1.0GA and 4.1.24
    Michael Wiezik Newbie
    There's a typo in the tittle of the message: it shoud be 'between jboss 5.1.0GA and 3.2.0'.
  • 2. Re: HeuristicMixedException for XA transaction between JBoss 5.1.0GA and 4.1.24
    Michael Wiezik Newbie

    The problem was with our custom XAResource. It reports a heuristic commit in a prepare() method. There two ways to do that from XAResource: either

     

         throw new XAException(XAException.XA_HEURCOM);  

     

    or

     

         return TwoPhaseOutcome.HEURISTIC_COMMIT; 
    . Both of them are acceptable by the older version of Arjuna and only the latter one does not cause transaction rollback in the newer Arjuna implementation.
  • 3. Re: HeuristicMixedException for XA transaction between JBoss 5.1.0GA and 4.1.24
    Andrew Dinn Master

    michaelwiezik wrote:

     

    The problem was with our custom XAResource. It reports a heuristic commit in a prepare() method. There two ways to do that from XAResource: either
         throw new XAException(XAException.XA_HEURCOM);  

     

    or

       return TwoPhaseOutcome.HEURISTIC_COMMIT

    . Both of them are acceptable by the older version of Arjuna and only the latter one does not cause transaction rollback in the newer Arjuna implementation.

    Perhaps you might just follow the link you cite to the XAResource javadoc and identify where it indicates that either of these are valid ways to exit from a prepare call?

     

    Ok, tried that? Didn't find it? Excellent! Problem solved.

  • 4. Re: HeuristicMixedException for XA transaction between JBoss 5.1.0GA and 4.1.24
    Michael Wiezik Newbie

    Andrew,

     

    I find it hard to understand your intentions behind the post. Was it supposed to be sarcastic / funny? This forum is to exchange useful information, not to mock people.

     

    I have changed the implementation of the XAResource after analyzing Arjuna source code. It seems to accept TwoPhaseOutcome.HEURISTIC_COMMIT - it simply works. Since I am migrating a legacy code, I had no influence over the original version and have limited options to amend it. And no, I haven't cited the link - it has been added automatically by the forum.

     

    If you are convinced it is a dodgy workaround or will not be supported in future versions, tell so, but please keep the discussion objective, as it is in all other topics on this site.

  • 5. Re: HeuristicMixedException for XA transaction between JBoss 5.1.0GA and 4.1.24
    Andrew Dinn Master

    michaelwiezik wrote:

     

    Andrew,

     

    I find it hard to understand your intentions behind the post. Was it supposed to be sarcastic / funny? This forum is to exchange useful information, not to mock people.

     


    Yes, it was meant to be funny and mildly sarcastic. You posted a note which i) pointed to the documentation for an interface and then ii) followed it up with not one but two accounts of how to code an implementation which, when compared against the API, is clearly invalid. You then ask whhether this might be the source of the error message. If I replied wiht "Doh" why are you surprised?

    I have changed the implementation of the XAResource after analyzing Arjuna source code. It seems to accept TwoPhaseOutcome.HEURISTIC_COMMIT - it simply works. Since I am migrating a legacy code, I had no influence over the original version and have limited options to amend it. And no, I haven't cited the link - it has been added automatically by the forum. If you are convinced it is a dodgy workaround or will not be supported in future versions, tell so, but please keep the discussion objective, as it is in all other topics on this site.

    Well, your code may indeed be wriong but the point was that the answer to what was wrong was right there in your note. Lots of people come here and ask for help but those who don't give their code a thorough check before asking generally get an unsympathetic reply, if only to encourage them to do a bit more research before askingnest time.

     

    It may be that the code you have been landed with got away with throwing the heuristic exception in the old TS implementation and, indeed that you can return the heuristic error code in the new version -- that does not make it any less non-conformant nor does it mean that it will do what you expect. JBossTS is not required to detect all errors in client code. Such a requirement would pose a herculean task for implementors of the JTA and would cause an unhealthy drag on TS performance.

     

    Returning TwoPhaseOutcome.HEURISTIC_COMMIT from  XAResource.prepare is most definitely a dodgy workaround. Go look at the documentation for XAResource.prepare again. Look at the return values cited in that documentation. They are XA_READONLY and XA_OK. Returning an integer constant defined by an unrelated class is like putting a revolver with 5/6 chambers loaded to your head, spinning it and pulling the trigger. If you want to be taken seriously as a programmer when you do things like that then you still have a lot of learning to do before that is going to happen. It's supposed to be precision engineering, not lucky dip. I think you got off lightly with my last note.

  • 6. Re: HeuristicMixedException for XA transaction between JBoss 5.1.0GA and 4.1.24
    Michael Wiezik Newbie

    Lots of people come here and ask for help but those who don't give their code a thorough check before asking generally get an unsympathetic reply, if only to encourage them to do a bit more research before askingnest time.

     

      If you aim to prove the JBoss team is a bunch of arrogants irritated by the incompetence of their own community, yeah, way to go. If you're suppressed by the amount of questions and interested in scaring people off so they shift to another forums / application servers, also way to go. Otherwise, I would change my attitude if I were you.

     

      I personally got used to the working culture where nobody asking questions is laughed at. I have seen people asking how to run jboss, and people answering 'click run.bat'. While different behaviour is quite common amongst people starting their career and not feeling secure with their knowledge, it's completely unacceptable for senior specialists. What makes you think I should know something straight away, just because it's obvious for you after n years spent in the same niche? And what makes you think I should take special care before posting the question? I have no time for that, my area of expertise is not the jboss implementation of transactions service. I am here, because I am hoping that somebody else will have the answer on the tip of his/her tongue. I am also happy if I find some question that I am able to answer straight away. And I truly believe this is the right approach, since the very next person having the same problem will be able to simply google out the solution in 5 secs.

     

      And, once again, I haven't posted links to XAResource. It has been added automatically.

     

      If you find a question too silly to answer without giving golden advices, sharing witty allegories and patronizing an interlocutor, simply don't. Seriously, don't. You are not welcomed. There are many people out there willing to help, not to show their own brightness and eloquence. I have posted the same problem in other forum and within 1 day had three different suggestions from another user.

  • 7. Re: HeuristicMixedException for XA transaction between JBoss 5.1.0GA and 4.1.24
    Andrew Dinn Master
    I have given your comments my full attention and will take them into account next time someone makes a fool of themselves on the forums.
  • 8. Re: HeuristicMixedException for XA transaction between JBoss 5.1.0GA and 4.1.24
    Michael Wiezik Newbie

      If I go to a client and they ask me: which platform to choose for their next strategic project, what shall I tell them? I would gladly recommend JBoss, but wouldn't it put my client into a risk of being called 'fool' in case of support need? Please, help me with this one. I really struggle to find a positive answer.

     

      Nota bene TwoPhaseOutcome.HEURISTIC_COMMIT is not an 'integer constant defined by an unrelated class'. Arjuna implementation in version 4.6.1.GA explicitely handles this value. Go back to the code, spend some time studying it and DON'T try to correct people with such nonchalance if you actually don't know what you are talking about.

  • 9. Re: HeuristicMixedException for XA transaction between JBoss 5.1.0GA and 4.1.24
    Michael Wiezik Newbie

      I can see it now in the code - transaction statuses are being translated from XAResource.* to TwoPhaseOutcome.* in the XAResourceRecord class, not directly passed from XAResource. My initial understanding was that TwoPhaseOutcome.* was a superset of XAResource.* constants and explicit reporting of the heuristic commit from the prepare phase was available in Arjuna before it has been JTA-compliant.

     

      So yes, you were completely right about the code and the API. My only point here is that this could be corrected in the course of objective discussion. I have been working with many brilliant people - none of them were free of mistakes and each of them was prepared to discuss the problem rather than fighting an opponent. That's my understanding of professionalism I'm trying to keep up with - you have a full right to have a different point of view on that matter.

  • 10. Re: HeuristicMixedException for XA transaction between JBoss 5.1.0GA and 4.1.24
    Andrew Dinn Master

    michaelwiezik wrote:

     

      I can see it now in the code - transaction statuses are being translated from XAResource.* to TwoPhaseOutcome.* in the XAResourceRecord class, not directly passed from XAResource. My initial understanding was that TwoPhaseOutcome.* was a superset of XAResource.* constants and explicit reporting of the heuristic commit from the prepare phase was available in Arjuna before it has been JTA-compliant.

     

    We rarely do anything like that. Spec-compliance is probably the most important requirement for our product. Without it our app server would not be able to advertise itself as a J2EE container. If we occasionally provide functionality which is not JTA conformant it is invariably an option which must be explcitly enabled. The default behaviour should never break an application which conforms to JTA.

  • 11. Re: HeuristicMixedException for XA transaction between JBoss 5.1.0GA and 4.1.24
    Mark Little Master
    It's also worth noting that JBossTS (aka Arjuna) has been compliant with JTA (obviously earlier versions) since 1998/1999 when it was acquired by Bluestone Software, a J2EE vendor at that time. This isn't something that has just happened as a result of acquisition by JBoss in 2005.