Announcement Announcement Module
Collapse
No announcement yet.
New Transaction over a rollback marked one. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • New Transaction over a rollback marked one.

    Hallo.

    I have a problem when I try to obtain a new transaction when the current one is rollback marked.

    I have a service fašade which performs a lot of validations through invoking others services. These services provide to the fašade one with a collection of detected validation errors and, if any have been detected, the last one throws a ValidationException.

    This exception is catched, in the class which invokes the fašade service, to persist the validation errors (as a collection within the exception) invoking the insertErrors() method.

    I'm using the WebLogicJtaTransactionManager and the following configuration:

    <prop key="insertErrors">
    PROPAGATION_REQUIRES_NEW
    </prop>

    <prop key="*" >
    PROPAGATION_REQUIRED, -ValidationException
    </prop>

    This behavior and configuration produces the following message, when the insertErrors() method is invocated:

    "The transaction is no longer active - status: 'Marked rollback. [Reason=weblogic.transaction.internal.AppSetRollbac kOnlyException]'. No further JDBC access is allowed within this transaction."

    I have used the PROPAGATION_NESTED with the same result.

    Why this don`t work properly?

    Thank you for your help.

    PD: sorry for my english!

  • #2
    Take a look at this section in reference documentation and see if your configuration is properly defined.

    If still having problems, post your config file, please.

    Comment


    • #3
      Sorry for may bad explanation.

      Hallo again.

      First of all, thank you for your answer, Andrei. I want to say sorry for may bad explanation too.

      The problem is that the current transaction is rollback marked and I need to open a new transaction to persist data.

      I am using iBatis in the persistence layer and the current complete configuration file is:

      <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

      <!-- Generic Transaction Manager
      <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSou rceTransactionManager">
      <property name="dataSource"> <ref bean="dataSource"/> </property>
      </bean> -->

      <!-- Transaction Manager Weblogic -->
      <bean id="transactionManager" class="org.springframework.transaction.jta.WebLogi cJtaTransactionManager">
      </bean>

      <bean id="baseTransactionInterceptor" class="org.springframework.transaction.interceptor .TransactionInterceptor">
      <property name="transactionManager" ref="transactionManager"/>
      <property name="transactionAttributes">
      <props>
      <prop key="insertErrors">
      PROPAGATION_REQUIRES_NEW
      </prop>
      <prop key="*" >
      PROPAGATION_REQUIRED,ISOLATION_DEFAULT,-ValidationException
      </prop>
      </props>
      </property>
      </bean>
      </beans>

      As I mentioned in the above post, I have tried to configure the "insertErrors" method as PROPAGATION_NESTED with the same result:

      "The transaction is no longer active - status: 'Marked rollback. [Reason=weblogic.transaction.internal.AppSetRollbac kOnlyException]'. No further JDBC access is allowed within this transaction."

      Why I can't open a new transaction? How do I solve the problem?

      Thank you.

      Comment


      • #4
        Is it possible you are calling the insertErrors method from another method within the same target bean? That way the TX attributes would be ignored because you are calling the target method not the proxy. You might have to resort to something like injecting the proxy into the target bean to get round this, or move the insertErrors method into a different class.

        Comment


        • #5
          Thank you for your answer, Dave.

          I don't know if I have understood you.

          I hava a 'A' class which invoke a 'B' class. This last throws a ValidationException (in this moment is rollback marked the current transaction) which is catched in the 'A' class.

          Now, I need to open a new transaction to persist the obtained validation errors. This persistence is performed through the 'insertErrors' method located in a 'C' class.

          If I understand you, this behavior is correct because the 'insertError' method is placed in another target bean.

          Doesn't it? Or must the 'insertError' invocation be placed in another bean instead of the 'A' class?

          Comment


          • #6
            I was a bit confused by your last sentence (seems to contradict the description above), but going by the 'A' 'B' 'C' description it sounds OK. You just have to make sure that the 'C' (where insertErrors is implemented) is a) proxied and b) injected by Spring into the 'A' which calls it. You haven't shown the configuration of those beans, or the AOP pointcut, so it isn't possible to tell from the information we have so far.

            Comment


            • #7
              Sorry, but

              the 'C' (where insertErrors is implemented) is a) proxied
              What do you mean, Dave?

              PD: the 'B' and 'C' classes are injected by Spring.

              Comment


              • #8
                The error you report seems to say that the PROPAGATION_REQUIRES_NEW attribute is not applying to the insertErrors method call. So my hypothesis was that the method was not called on a proxy with transactional capabilities at all (hence no way for it to be applied). Is your 'C' bean a transactional proxy (it's impossible to say from the information we have)? Can you post the configuration?

                Comment


                • #9
                  Hello, again.

                  Sorry for the delay in replying. You have reason, Dave. The problem is that the insertError() invocation is not performed through the proxy which envolve the C class. It provokes that the transaction configuration does not take effect.

                  Thanks to Andrei and specially to Dave.

                  Comment

                  Working...
                  X