Announcement Announcement Module
Collapse
No announcement yet.
JpaExceptionTranslatorAspect clashes with PersistenceExceptionTranslationInterceptor Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JpaExceptionTranslatorAspect clashes with PersistenceExceptionTranslationInterceptor

    Just moved to use CTW with maven-aspect-plugin in order to get better handling on @Transactional.

    I've got failing test because PersistenceExceptionTranslationInterceptor doesn't do its job properly anymore: the exceptions it is supposed to manage get transformed by JpaExceptionTranslatorAspect first, which does a far worse job, and transform the exception into something PersistenceExceptionTranslationInterceptor cannot in turn translate properly anymore.

    Basically, it relies on EntityManagerFactoryUtils to translate and doesn't get into the Dialect impl itself, which knows precisely how to translate.

    Hope I'm making sense for someone here.

    I was hoping to just exclude the Aspect from the CTW with

    <excludes>
    <exclude>**/JpaExceptionTranslatorAspect*</exclude>
    </excludes>

    in the maven-aspectj-plugin.
    I've tried different matching pattern, but it always get woven.

    Is it because I specify spring-aspects in AspectLibrairies?

    here's my config:

    <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>aspectj-maven-plugin</artifactId>
    <version>1.3.1</version>
    <configuration>
    <source>1.6</source>
    <target>1.6</target>
    <complianceLevel>1.6</complianceLevel>
    <encoding>${encoding}</encoding>
    <excludes>
    <exclude>**/JpaExceptionTranslatorAspect.aj</exclude>
    </excludes>
    <aspectLibraries>
    <aspectLibrary>
    <groupId>org.springframework</groupId>
    <artifactId>spring-aspects</artifactId>
    </aspectLibrary>
    </aspectLibraries>
    </configuration>
    <executions>
    <execution>
    <goals>
    <goal>compile</goal>
    <!--<goal>test-compile</goal>-->
    </goals>
    </execution>
    </executions>
    </plugin>

    hope someone can help
    cheers
    Last edited by Jean; Mar 22nd, 2011, 05:13 AM.

  • #2
    Hi Jean,

    Did you find any solution? I have the same problem. The exclude is ignored by the aspectj maven plugin.
    I played around with the xmlConfigured option but this is not well documented and also worked not for me.

    Anyone else have a solution? The problem is i want to use Compile Time Weaving with eclipse and maven and spring but the the JpaExceptionTranslatorAspect is woven into my classes which i do not want.

    cheers tom

    Comment


    • #3
      hi tom,

      unfortunately I've given up on CTW because of this problem.
      I started to look into aspectj maven plugin sources to see what I could do to get the exclusion working but ran out of time, and never got back to the problem.

      I was hoping it would get solve with the new releases of the aspectj maven plugin, but if you still have the problem, exclusion is probably still not working for this case.

      Which version of the plugin did you use?

      Comment


      • #4
        Hi jean,

        I used for everything the latest version spring (3.2), aspectj maven plugin 1.4 (http://mojo.codehaus.org/aspectj-mav...gin/usage.html) AspectJ 1.7.2, also tried with 1.6.11.

        Its a pitty that such a "simple" feature like exclude is not working
        I know simple requirement, big change

        Dont have time to hack the aspectj maven plugin. Maybe this is the corresponding issue? http://jira.codehaus.org/browse/MASPECTJ-94

        These are the issues I have found
        http://jira.codehaus.org/issues/?jql...updated%20DESC

        As i am new to AspectJ i dont have the whole understanding how Eclipse AJDT, the ajc and the aspectj maven plugin is working together.

        But it seems there is no solution ready yet
        Still have to find a way to prevent Eclipse from using the JpaExceptionTranslatorAspect located in the spring-aspectj-xxx.jar when using CTW

        cheers tom
        Last edited by spring-tom; Apr 3rd, 2013, 11:12 AM.

        Comment


        • #5
          Also found some interesting JIRA discussion: https://jira.springsource.org/browse/SPR-7649
          And this discussion: http://aspectj.2085585.n4.nabble.com...td2084965.html
          Last edited by spring-tom; Apr 3rd, 2013, 12:05 PM.

          Comment

          Working...
          X