Announcement Announcement Module
Collapse
No announcement yet.
Roo JpaExceptionTranslatorAspect problems and solution Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Roo JpaExceptionTranslatorAspect problems and solution

    So I recently upgraded to STS 2.5.2 and Roo 1.1.1 (from 1.1.0) and had a heckuva day getting my project to work again. I thought I'd share some of the trouble and what I did to fix it so that any googling out there might stumble across this.

    My biggest issue was that exception translation was dead. It was evidenced by this type of warning for every entity in my domain:

    Code:
    error aspect 'org.springframework.orm.jpa.aspectj.JpaExceptionTranslatorAspect' woven into 'com.foo.domain.SomeEntity' must be defined to the weaver (placed on the aspectpath, or defined in an aop.xml file if using LTW).
    Now, supposedly, this shouldn't have been an issue, but it was. I found some threads that said I needed to have "Outxml" checked under the Aspect Compiler -> Other section of my project settings. However, it was already checked. Took me a while, but I finally figured out a "fix," which was to create a file named aop.xml and put it in src/main/resources/META-INF with this content:

    Code:
    <aspectj>
    	<aspects>
    		<aspect name="org.springframework.mock.staticmock.AnnotationDrivenStaticEntityMockingControl"/>
    		<aspect name="org.springframework.orm.jpa.aspectj.JpaExceptionTranslatorAspect"/>
    	</aspects>
    </aspectj>
    Oh, the other aspect mentioned in that block was also giving me similar warnings in my log.

    I hope this helps someone in desperate need to get back to a productive day. I'm not sure why moving from Roo 1.1.0 to Roo 1.1.1 caused this problem. If anyone has any insight into the root cause, please do post.

  • #2
    This is interesting.

    Can you share a sample application which indicates the issue you are seeing?

    We would be interested in the AspectJ version being used (Roo 1.1.0 shipped with AspectJ: 1.6.10 and Roo 1.6.11.M1. However, dependency versions are not automatically updated, so we are not clear if you have done that manually or left it at 1.6.10.

    The aop xml files that define the aspects somehow do not seem to work here should be packaged in the spring jars alongside the classfiles for the aspects - it is worth checking what is in those spring jars. And if you are building with the outxml project turned on for the project, it would be interesting to see if a suitable aop*.xml file was being created in the output folder for your project build.

    Cheers,
    Stefan

    Comment


    • #3
      Well, the app is closed source, and I don't really have the time at the moment to create a new one and wait for it to break. But, I will say that I am still using AspectJ 1.6.10 with Roo 1.1.1. (In other words, I did not upgrade AspectJ when upgrading Roo.) Maybe I will give 1.6.11.M1 a shot. An aop-ajc.xml is indeed being created but with no entry for either JpaExceptionTranslatorAspect or AnnotationDrivenStaticEntityMockingControl. All the other Roo aspects, however, are in that generated file. Here is the aop.xml file that is packaged within sprint-aspects-3.0.5.jar:

      Code:
      <?xml version="1.0"?>
      
      <!--
      	AspectJ load-time weaving config file to install common Spring aspects.
      -->
      <aspectj>
      
      	<!--
      	<weaver options="-showWeaveInfo"/>
      	-->
      
      	<aspects>
      		<aspect name="org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect"/>
      		<aspect name="org.springframework.scheduling.aspectj.AnnotationAsyncExecutionAspect"/>
      		<aspect name="org.springframework.transaction.aspectj.AnnotationTransactionAspect"/>
      	</aspects>
      
      </aspectj>
      So, they're not in there either. For now, everything is working with my custom aop.xml file, so I'm hesitant to start messing with things. =) However, when I get some downtime, I will try upgrading AspectJ to the latest milestone and see if that changes things.

      Comment


      • #4
        Just FYI, I've recently upgraded to STS 2.6.0.M2 with Roo 1.1.2.RELEASE. I create a brand new Roo project from scratch in the new environment, and this problem still persists. I'm on a Mac if that helps.

        Comment

        Working...
        X