Results 1 to 10 of 10

Thread: AspectJ weaving problem

  1. #1
    Join Date
    May 2009
    Posts
    246

    Default 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 at 05:28 PM.

  2. #2
    Join Date
    May 2009
    Posts
    246

    Default

    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 at 09:04 PM.

  3. #3
    Join Date
    May 2009
    Posts
    246

    Default

    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

  4. #4
    Join Date
    May 2009
    Location
    Vancouver
    Posts
    274

    Default

    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

  5. #5
    Join Date
    May 2009
    Posts
    246

    Default

    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!

  6. #6
    Join Date
    Nov 2009
    Posts
    12

    Default

    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?
    Attached Files Attached Files

  7. #7
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    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,
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  8. #8
    Join Date
    Apr 2010
    Posts
    8

    Default 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

  9. #9
    Join Date
    Mar 2011
    Posts
    7

    Default

    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

  10. #10
    Join Date
    May 2011
    Posts
    7

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •