Announcement Announcement Module
No announcement yet.
Service Methods not being wrapped by TransactionInterceptor Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Service Methods not being wrapped by TransactionInterceptor

    I've been pulling hair out over this one, very frustrating. But I have the standard (as in the code from the docs), to do XA demarcation declaratively, and it has worked in several projects, and for some reason doesn't perform correctly for this project.

    I believe I've narrowed it down to the TransactionProxyFactoryBean not wrapping my target bean with the TransactionInterceptor. Because TransactionInterceptor never sees any logging in my app. And any calls to get the .currentTransactionStatus() are met with failure.

    My question I guess relates to, how do I accurately gauge why Spring is not wrapping this target class correctly, I've gone through everything I can think of, but it just doesn't make any sense.

    Does the order in which items appear in the spring xml file matter? should the DAOs go above the service objects, below them? I have this working in another project but can't see what the problem is comparing the 2.

    Using the same library as well, so that doesn't seem to be the issue.

  • #2
    Order does not matter!

    Have you tried changing your configuration a bit? For example wrap the target as an inner beans in the TPFB. If this doesn't reault in correct proxy creation than something really werid is going on .

    <bean id="service" class="org.spr...TransactionProxyFactoryBean">
      <property name="target">
        <bean class="com.acme...TargetObject">
          <!-- properties -->
    Hope this helps,
    Alef Arendsen


    • #3
      At a complete loss

      Well I've hbad it wrapped as a TransationProxyFactoryBean, and as just a ProxyFactoryBean with the TransactionInterceptor defined separately. And both do not wrap the service method correctly, and I get the same result.

      I've even tried taking out every other bean that didn't depend on this transaction, and ran it, and still get the same result.

      Is there something in code that might be tripping this proxying action up? Is it something in my config? the web.xml maybe? The thing is, I've only just copied it exactly the way it was in every other project.



      • #4
        Could you show me some code (config, calling code)? There's no way really that the call is bypassing the interceptor if it's configured correctly, except for one case: when you're inside the proxy already and making a call to a method within the same object.

        web.xml shouldn't have anything to do with it.

        Alef Arendsen


        • #5
          when it rains ... it pours

          thank god for good debuggers,...

          i figured out that the problem didn't exist with Spring Framework, it was with the integration between Spring and WebWork 2. the line

          <external-ref name="serviceObject" />
          was how I was referencing the service beans that needed wrapping. well I wasn't sure until I read the source to the reference-resolver interceptor that there was my problem. It has to be specified with data within the tags specifying the object to lookup

          <external-ref name="serviceObject">serviceObject</external-ref>
          Thanks for your help[/code]