Announcement Announcement Module
Collapse
No announcement yet.
AspectJ weaving problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • AspectJ weaving problem

    Hi, I just upgraded a project from 3.0.0.RC1 to 3.0.1.RELEASE, and I get some weird aspectj errors.

    Basically, this repeats over and over for a whole bunch of classes in the system:

    Code:
    [ERROR] can't determine annotations of missing type javax.persistence.Entity
    when weaving type jobprep.web.controllers.admin.OpenEndedQuestionsController
    when weaving classes 
    when weaving 
    when batch building BuildConfig[null] #Files=164 AopXmls=#0
     [Xlint:cantFindType]
    I made sure to upgrade maven to use 1.6.7 instead of 1.6.5 of both the aspectj libraries. Is there anything else I should be aware of?

    This is maven code I'm using:

    Code:
    			<plugin>
    				<groupId>org.codehaus.mojo</groupId>
    				<artifactId>aspectj-maven-plugin</artifactId>
                    <version>1.3</version>
    				<configuration>
    					<complianceLevel>1.5</complianceLevel>
    					<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>
    Last edited by mystic; Mar 3rd, 2010, 05:28 PM.

  • #2
    Oh, and if I use versions 1.6.5 of aspectj libraries with the version 1.2 of the aspectj maven plugin (not 1.3, like above), I get only 1 error that looks like this:

    Code:
    [INFO] [aspectj:compile {execution: default}]
    [ERROR] can't determine annotations of missing type javax.persistence.Entity
    when weaving classes 
    when weaving 
    when batch building BuildConfig[null] #Files=164 AopXmls=#0
     [Xlint:cantFindType]
    [WARNING] advice defined in org.springframework.orm.jpa.aspectj.JpaExceptionTranslatorAspect has not been applied [Xlint:adviceDidNotMatch]
    [WARNING] advice defined in org.springframework.mock.staticmock.AnnotationDrivenStaticEntityMockingControl has not been applied [Xlint:adviceDidNotMatch]
    [WARNING] advice defined in org.springframework.mock.staticmock.AbstractMethodMockingControl has not been applied [Xlint:adviceDidNotMatch]
    [WARNING] advice defined in org.springframework.mock.staticmock.AbstractMethodMockingControl has not been applied [Xlint:adviceDidNotMatch]
    I an not even using JPA...
    Last edited by mystic; Mar 3rd, 2010, 09:04 PM.

    Comment


    • #3
      Running it with a load-time weaver instead of the maven compile-time weaver results in this error:

      Code:
       WARN AspectJ Weaver:70 - [AspectJ] javax.* types are not being woven because the weaver option '-Xset:weaveJavaxPackages=true' has not been specified
      ERROR AspectJ Weaver:77 - [AspectJ] class 'jobprep.domain.question.openended.OpenEndedResult' is already woven and has not been built in reweavable mode

      Comment


      • #4
        Hi,

        I'm afraid I don't speak maven personally, but I have seen some discussions around that particular error "can't determine annotations of missing type javax.persistence.Entity". Does this JIRA help at all?

        http://jira.springframework.org/browse/SPR-6819

        despite what it says, I'm not 100% sure the change to <scope>provided</scope> made it into 3.0.1

        Andy
        ---
        Andy Clement
        AspectJ Project Lead

        Comment


        • #5
          Thanks so much Andy. This fixed my problem 100%.

          Curious. The jira thread indicates this was fixed with 3.0.1, but that is the version I got this error with. It works fine either with the 1.2 or 1.3 version of the maven aspectj plugins.

          My intuition thinks this was not yet put into version 3.0.1, or my maven config is somewhat messed up.

          Code:
          	<properties>
          		<spring.version>3.0.1.RELEASE</spring.version>
                  <spring-security.version>3.0.0.RC1</spring-security.version>
          		<env>test</env>
                  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
          	</properties>
          
                  ....
          
                  <!-- SPRING -->
                  <dependency>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring-core</artifactId>
                      <version>${spring.version}</version>
                  </dependency>
                  <dependency>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring-test</artifactId>
                      <version>${spring.version}</version>
                      <scope>test</scope>
                  </dependency>
                  <dependency>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring-web</artifactId>
                      <version>${spring.version}</version>
                  </dependency>
                  <dependency>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring-webmvc</artifactId>
                      <version>${spring.version}</version>
                  </dependency>
                  <dependency>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring-jdbc</artifactId>
                      <version>${spring.version}</version>
                  </dependency>
                  <dependency>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring-context</artifactId>
                      <version>${spring.version}</version>
                  </dependency>
                  <dependency>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring-context-support</artifactId>
                      <version>${spring.version}</version>
                  </dependency>
                  <dependency>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring-aop</artifactId>
                      <version>${spring.version}</version>
                  </dependency>
                  <dependency>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring-aspects</artifactId>
                      <version>${spring.version}</version>
                  </dependency>
                  <dependency>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring-orm</artifactId>
                      <version>${spring.version}</version>
                      <exclusions>
                          <exclusion>
                              <groupId>org.slf4j</groupId>
                              <artifactId>slf4j-jdk14</artifactId>
                          </exclusion>
                      </exclusions>
                  </dependency>
                  <dependency>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring-tx</artifactId>
                      <version>${spring.version}</version>
                  </dependency>
                  <dependency>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring-oxm</artifactId>
                      <version>${spring.version}</version>
                  </dependency>
          Thanks!

          Comment


          • #6
            Hi,
            I've got the same issue with Spring 3.0.2.RELEASE with the error message:

            PHP Code:
            Caused byorg.codehaus.mojo.aspectj.CompilationFailedExceptionCompiler errors:
            error at (no source information available)
            D:\projets\workspace\workspace\sample-config\sample-webapp\src\main\java\org\tests\sample\dto\Foo.java:0::0 can't determine annotations of missing type javax.persistence.Entity
            when weaving type org.tests.sample.dto.Foo
            when weaving classes 
            when weaving 
            when batch building BuildConfig[null] #Files=2 AopXmls=#0
             [Xlint:cantFindType] 
            I've attached a zip with a project sample in case you wish to reproduce the issue.
            As mentionned above, adding the dependency fix the issue:

            PHP Code:
             <dependency>
                  <
            groupId>javax.persistence</groupId>
                  <
            artifactId>persistence-api</artifactId>
                  <
            version>1.0</version>
                  <
            scope>provided</scope>
                </
            dependency
            Should the issue http://jira.springframework.org/browse/SPR-6819 be re-opened for Spring 3.0.2.RELEASE?

            Comment


            • #7
              Hi guys,

              Indeed the change in 3.0.1 marked the JPA dependency as optional meaning clients had to manually request it. The reason for that is the multiple areas in which the aspects work, JPA being only one of them.
              However based on your requests, we've changed this in 3.0.3 to provided meaning now the JPA API should be included automatically.
              Hopefully this won't cause too much trouble for those not using JPA.

              The change has been committed in the trunk - please give it a try if you can.
              Thanks,

              Comment


              • #8
                Still not working in 3.0.3-RELEASE

                I have just upgraded to 3.0.3-RELEASE and it appears the JPA dependency is still "optional" in the POM. Looks like a packaging issue when creating the final release artifacts.

                I have updated JIRA accordingly: http://jira.springframework.org/browse/SPR-6819

                Comment


                • #9
                  Hi,

                  I am using following maven plug in

                  <plugin>
                  <groupId>org.codehaus.mojo</groupId>
                  <artifactId>aspectj-maven-plugin</artifactId>
                  <version>1.3</version>
                  <dependencies>
                  <!-- NB: You must use Maven 2.0.9 or above or these are ignored (see
                  MNG-2972) -->
                  <dependency>
                  <groupId>org.aspectj</groupId>
                  <artifactId>aspectjrt</artifactId>
                  <version>${aspectj.version}</version>
                  </dependency>
                  <dependency>
                  <groupId>org.aspectj</groupId>
                  <artifactId>aspectjtools</artifactId>
                  <version>${aspectj.version}</version>
                  </dependency>
                  </dependencies>
                  <executions>
                  <execution>
                  <goals>
                  <goal>compile</goal>
                  <goal>test-compile</goal>
                  </goals>
                  </execution>
                  </executions>
                  <configuration>
                  <outxml>true</outxml>
                  <aspectLibraries>
                  <aspectLibrary>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-aspects</artifactId>
                  </aspectLibrary>
                  </aspectLibraries>
                  <source>1.6</source>
                  <target>1.6</target>
                  </configuration>
                  </plugin>

                  aspectj.version is 1.6.9
                  Spring version : 3.0.3.RELEASE

                  However through I am annotating my JUnit tests with @Transactional annotation, the code is not committing record

                  error is as following :

                  [INFO] [aspectj:test-compile {execution: default}]
                  [WARNING] advice defined in org.springframework.orm.jpa.aspectj.JpaExceptionTr anslatorAspect has not been applied [Xlint:adviceDidNotM
                  atch]
                  [WARNING] advice defined in org.springframework.mock.staticmock.AnnotationDriv enStaticEntityMockingControl has not been applied [Xlint
                  :adviceDidNotMatch]
                  [WARNING] advice defined in org.springframework.mock.staticmock.AbstractMethod MockingControl has not been applied [Xlint:adviceDidNotM
                  atch]
                  [WARNING] advice defined in org.springframework.mock.staticmock.AbstractMethod MockingControl has not been applied [Xlint:adviceDidNotM
                  atch]

                  Also I had to manually enter following to get spring - tx on the classpath

                  <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-tx</artifactId>
                  <version>${spring.version}</version>
                  <scope>compile</scope>
                  </dependency>

                  is it I must do?

                  Any help on this will be highly appreciated

                  Thanks

                  Comment


                  • #10
                    MaveN Repository is very useful to build the many aaplication in one shot. But if its not ut updated or the relation between parent and child or any Tag is missing, then it ceates a problem. I don't think its there is need of manual configuration is required

                    Comment

                    Working...
                    X