Announcement Announcement Module
Collapse
No announcement yet.
Transaction error help Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Transaction error help

    Hi,

    I have a business object whose methods I want to execute transactionally, except for one method. The object is proxied by a TransactionProxyFactoryBean declared in the Spring config file. Let us say the object is Foo and the methods are bar0, bar1, bar2, etc. bar0 has the attribute PROPAGATION_NOT_SUPPORTED and the rest of the methods have the attribute PROGAGATION_REQUIRED. bar0 and bar1 read data from the MS SQL Server database db1 and bar2 reads data from the both db1 and another MS SQL Server database db2.

    Now I have this sequence of calls within another object's method:

    Foo foo = .. (get foo bean from the config file)
    foo.bar0();
    foo.bar1();

    Where in Foo, I have

    public void bar0() {
    // Read some data from db1
    ...
    }

    public void bar1() {
    // Read some data from db1
    ....
    this.bar2();
    }

    public void bar2() {
    // Read some data from db1
    ...
    // Read some data from db2
    ...
    }


    In the line where bar2() reads data from db2, I get this exception:

    javax.transaction.xa.XAException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Import of MSDTC transaction failed: Result Code = 0x8004d00e.

    So, the read from the second database fails.
    We have another instance in the application where we read data from the second database using a method with PROPAGATION_NOT_SUPPORTED and it works. The SQL Server seems to be OK.


    So, does anyone know why the transaction would fail in this case?

    Thanks in advance.
    Last edited by imchi; Jul 13th, 2007, 05:39 PM.

  • #2
    RE: Transaction error help

    I'm not a Spring expert but perhaps you're creating nested transactions by invoking the bar2 method within the bar1 method. Just a guess.

    Comment


    • #3
      The usual problem of misunderstanding AOP proxies seems not to apply here since bar1() is also transactionally. Have you tried to call bar2() from outside, i.e. foo.bar2()?

      Having a look at what the error message might mean I only found:

      The error message says that SQL Server can not enlist in the transaction that is provide because the transaction is already implicitly or explicitly committed or aborted.
      That might point to an error in the transaction setup, e.g. the transaction gets auto-committed.

      Jörg

      Comment


      • #4
        Originally posted by djheath View Post
        I'm not a Spring expert but perhaps you're creating nested transactions by invoking the bar2 method within the bar1 method. Just a guess.
        As Jörg said, this doesn't actual create another transaction (unless you are using AspectJ). I would turn the logging up and post that, it might provide more clues about what's going on!
        http://static.springframework.org/sp...ng-aop-proxies
        Last edited by karldmoore; Aug 29th, 2007, 09:59 AM.

        Comment


        • #5
          Originally posted by Jörg Heinicke View Post
          The usual problem of misunderstanding AOP proxies seems not to apply here since bar1() is also transactionally. Have you tried to call bar2() from outside, i.e. foo.bar2()?

          Having a look at what the error message might mean I only found:



          That might point to an error in the transaction setup, e.g. the transaction gets auto-committed.

          Jörg
          Thanks for you suggestions. Calling bar2() from outside gives the same error.
          I don't understand this: if this is a read-only operation and I have no previous write operations of that database, why would it matter whether it auto-commits?

          Comment


          • #6
            Originally posted by imchi View Post
            if this is a read-only operation and I have no previous write operations of that database, why would it matter whether it auto-commits?
            It doesn't matter if it was a read-only operation or not. The transaction is committed - and SQLServer complains. But have in mind that this was only a guess. Only you can find out in which state your transaction is when this error occurs.

            Originally posted by imchi View Post
            Calling bar2() from outside gives the same error.
            That does not really point to such an error though.

            Jörg

            Comment

            Working...
            X