Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Cross Store aspectj errors in build. Not sure why

  1. #1
    Join Date
    Jan 2009
    Location
    Huntington Beach, CA
    Posts
    718

    Default Cross Store aspectj errors in build. Not sure why

    Here are some examples of what I see when I run maven.

    [ERROR] can't override org.springframework.data.neo4j.aspects.core.NodeBa cked org.springframework.data.neo4j.aspects.core.NodeBa cked.persist() with T org.springframework.data.neo4j.aspects.core.NodeBa cked.persist() return types don't match
    [ERROR] can't override org.springframework.data.neo4j.aspects.core.NodeBa cked org.springframework.data.neo4j.aspects.core.NodeBa cked.persist() with T org.springframework.data.neo4j.aspects.core.NodeBa cked.persist() return types don't match
    [ERROR] can't override java.lang.Object org.springframework.data.neo4j.mapping.ManagedEnti ty.persist() with T org.springframework.data.neo4j.aspects.core.NodeBa cked.persist() return types don't match
    [ERROR] can't override java.lang.Object org.springframework.data.neo4j.mapping.ManagedEnti ty.persist() with T org.springframework.data.neo4j.aspects.core.NodeBa cked.persist() return types don't match
    [ERROR] can't override java.lang.Object org.springframework.data.neo4j.aspects.core.GraphB acked.getPersistentState() with org.neo4j.graphdb.Node org.springframework.data.neo4j.aspects.core.NodeBa cked.getPersistentState() return types don't match
    [ERROR] can't override java.lang.Object org.springframework.data.neo4j.aspects.core.GraphB acked.getPersistentState() with org.neo4j.graphdb.Node org.springframework.data.neo4j.aspects.core.NodeBa cked.getPersistentState() return types don't match


    Thanks

    Mark

  2. #2
    Join Date
    Jan 2011
    Location
    Dresden, Germany
    Posts
    525

    Default

    What AJ version are you using, and what SDN version? Do you have an example for your entity and the pom.xml.

    Sounds like a generics issue. So perhaps something about the Java-version?

    Can you share the relevant parts of your projects and/or a sample project? Then I can also ask Andy Clement the AJ project lead to look into this.

  3. #3
    Join Date
    Jan 2009
    Location
    Huntington Beach, CA
    Posts
    718

    Default

    Yeah, this project I can't share anything in code.

    But here are the versions

    Java 7
    SDN - <spring-data-neo4j.version>2.1.0.RELEASE</spring-data-neo4j.version>
    AspectJ - <aspectj.version>1.6.12</aspectj.version>

    Also we are using Groovy so in the compiler plugin
    Code:
    <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.3.2</version>
                    <configuration>
                        <source>1.7</source>
                        <target>1.7</target>
                        <compilerId>groovy-eclipse-compiler</compilerId>
                        <verbose>false</verbose>
                        <encoding>UTF-8</encoding>
                    </configuration>
                    <dependencies>
                      <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-eclipse-compiler</artifactId>
                        <version>2.7.0-01</version>
                      </dependency>
                    </dependencies>
                </plugin>
    FOr the aspectJ plugin

    Code:
    <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>aspectj-maven-plugin</artifactId>
                    <version>1.2</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>1.6.12</version>
                        </dependency>
                        <dependency>
                            <groupId>org.aspectj</groupId>
                            <artifactId>aspectjtools</artifactId>
                            <version>1.6.12</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>
                            <aspectLibrary>
                                <groupId>org.springframework.data</groupId>
                                <artifactId>spring-data-neo4j-aspects</artifactId>
                            </aspectLibrary>
                        </aspectLibraries>
                        <source>1.7</source>
                        <target>1.7</target>
                    </configuration>
                </plugin>
    I guess I can post one domain object

    Code:
    @Entity
    @Table(name="AccountUser")
    @NodeEntity(partial = true)
    class Account implements UserDetails {
    
      public static final String FAVORITE_TABLES = "FAVORITE_TABLES";
      public static final String FAVORITE_VIDEOS = "FAVORITE_VIDEOS";
      public static final String FRIENDS_LIST = "FRIENDS_LIST";
      public static final String USER_VIDEOS = "USER_VIDEOS";
      public static final String USER_MAILBOX = "USER_MAILBOX";
    
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      Long id
    
      String firstName
      String lastName
      Locale locale
      TimeZone timeZone
      Date lastModified
      Date birthday
      @ManyToOne
      @JoinColumn(name="currency_id")
      Currency currencyId
      String email
    
    
      @ManyToMany(cascade = CascadeType.ALL)
      Set<UserGroup> groups
    
      @ManyToMany(cascade = CascadeType.ALL)
      Set<UserRole> roles
    
        // Properties for UserDetails
      Collection<? extends GrantedAuthority> getAuthorities() {
        Collection<? extends GrantedAuthority> authorities = new ArrayList<? extends GrantedAuthority>()
        roles.each{ role ->
          authorities << new SimpleGrantedAuthority(role.role)
        }
        groups.each{ group ->
          authorities << new SimpleGrantedAuthority(group.group)
        }
        return authorities
      }
    
      String password
      String username
    
      @Transient
      boolean accountNonExpired = true
    
      @Transient
      boolean accountNonLocked = true
    
      @Transient
      boolean credentialsNonExpired = true
    
      @Transient
      boolean enabled = true
    
      // Neo4 Graph stuff
    
      @GraphId
      //@Transient
      Long nodeId
    
      @RelatedTo(type = Account.FAVORITE_TABLES)
      //@Transient
      Set<GameTable> favoriteTables
    
      public void addFavoriteTables(GameTable favoriteTable) {
        if (favoriteTables == null) {
            this.favoriteTables = new HashSet<GameTable>();
        }
        favoriteTables.add(favoriteTable);
      }
    
      @RelatedTo(type = Account.FAVORITE_VIDEOS)
      //@Transient
      Set<Video> favoriteVideos
    
      public void addFavoriteVideos(Video favoriteVideo) {
        if (favoriteVideos == null) {
            this.favoriteVideos = new HashSet<Video>();
        }
        favoriteVideos.add(favoriteVideo);
      }
    
      @RelatedToVia(type = Account.USER_VIDEOS)
      //@Transient
      Set<VideoUpload> myVideos
    
      public void addMyVideo(VideoUpload myVideo) {
        if (myVideos == null) {
            this.myVideos = new HashSet<VideoUpload>();
        }
        myVideos.add(myVideo);
      }
    
      @RelatedToVia(type = Account.FRIENDS_LIST)
      //@Transient
      Set<FriendList> friendLists
    
      public void addFriendList(FriendList friendList) {
        if (friendLists == null) {
            this.friendLists = new HashSet<FriendList>();
        }
        friendLists.add(friendList);
      }
    
      @RelatedToVia(type = Account.USER_MAILBOX)
      //@Transient
      Set<MailboxMessage> mailboxMessages
    
      public void addMailboxMessage(MailboxMessage mailboxMessage) {
        if (mailboxMessages == null) {
            this.mailboxMessages = new HashSet<MailboxMessage>();
        }
        mailboxMessages.add(mailboxMessage);
      }
    }
    Thanks Michael

    Mark

  4. #4
    Join Date
    Jan 2011
    Location
    Dresden, Germany
    Posts
    525

    Default

    Forwarded it to Andy Clement for clarification.

  5. #5
    Join Date
    Jan 2009
    Location
    Huntington Beach, CA
    Posts
    718

    Default

    OK. Since you mentioned something about versions. I bumped up the aspectj version to 1.7.1. So it changed my errors. to

    Code:
    Information:Compilation completed with 28 errors and 11 warnings in 15 sec
    Information:28 errors
    Information:11 warnings
    Warning:ajc: advice defined in org.springframework.orm.jpa.aspectj.JpaExceptionTranslatorAspect has not been applied [Xlint:adviceDidNotMatch]
    Warning:ajc: advice defined in org.springframework.scheduling.aspectj.AbstractAsyncExecutionAspect has not been applied [Xlint:adviceDidNotMatch]
    Warning:ajc: advice defined in org.springframework.data.neo4j.aspects.support.node.Neo4jNodeBacking has not been applied [Xlint:adviceDidNotMatch]
    Warning:ajc: advice defined in org.springframework.data.neo4j.aspects.support.node.Neo4jNodeBacking has not been applied [Xlint:adviceDidNotMatch]
    Warning:ajc: advice defined in org.springframework.data.neo4j.aspects.support.node.Neo4jNodeBacking has not been applied [Xlint:adviceDidNotMatch]
    Warning:ajc: advice defined in org.springframework.data.neo4j.aspects.support.relationship.Neo4jRelationshipBacking has not been applied [Xlint:adviceDidNotMatch]
    Warning:ajc: advice defined in org.springframework.data.neo4j.aspects.support.relationship.Neo4jRelationshipBacking has not been applied [Xlint:adviceDidNotMatch]
    Warning:ajc: advice defined in org.springframework.data.neo4j.aspects.support.relationship.Neo4jRelationshipBacking has not been applied [Xlint:adviceDidNotMatch]
    Warning:ajc: advice defined in org.springframework.mock.staticmock.AnnotationDrivenStaticEntityMockingControl has not been applied [Xlint:adviceDidNotMatch]
    Warning:ajc: advice defined in org.springframework.mock.staticmock.AbstractMethodMockingControl has not been applied [Xlint:adviceDidNotMatch]
    Warning:ajc: advice defined in org.springframework.mock.staticmock.AbstractMethodMockingControl has not been applied [Xlint:adviceDidNotMatch]
    /Users/bytor99999/Documents/blah/blah/blahProjects/blah/blah-core/src/main/java/com/blah/account/configuration/JpaDevBeanConfiguration.java
        Error:Error:line (3)ajc: The import com.blah.annotations cannot be resolved
        Error:Error:line (28)ajc: AccountServerApp cannot be resolved to a type
    /Users/bytor99999/Documents/blah/blah/blahProjects/blah/blah-core/src/main/java/com/blah/account/configuration/JpaProdBeanConfiguration.java
        Error:Error:line (3)ajc: The import com.blah.annotations cannot be resolved
        Error:Error:line (28)ajc: AccountServerApp cannot be resolved to a type
    /Users/bytor99999/Documents/blah/blah/blahProjects/blah/blah-core/src/main/java/com/blah/account/domain/device/MobileDevice.java
        Error:Error:line (3)ajc: The import com.blah.account.domain.user.Account cannot be resolved
    /Users/bytor99999/Documents/blah/blah/blahProjects/blah/blah-core/src/main/java/com/blah/account/repository/UserRepository.java
        Error:Error:line (3)ajc: The import com.blah.account.domain.user.Account cannot be resolved
        Error:Error:line (11)ajc: Account cannot be resolved to a type
        Error:Error:line (13)ajc: Account cannot be resolved to a type
    /Users/bytor99999/Documents/blah/blah/blahProjects/blah/blah-core/src/main/java/com/blah/domain/media/Photo.java
        Error:Error:line (4)ajc: The import com.blah.account.domain.user.Account cannot be resolved
        Error:Error:line (24)ajc: Account cannot be resolved to a type
    /Users/bytor99999/Documents/blah/blah/blahProjects/blah/blah-core/src/main/java/com/blah/domain/media/Video.java
        Error:Error:line (4)ajc: The import com.blah.account.domain.user.Account cannot be resolved
        Error:Error:line (28)ajc: Account cannot be resolved to a type
        Error:Error:line (31)ajc: Account cannot be resolved to a type
    /Users/bytor99999/Documents/blah/blah/blahProjects/blah/blah-core/src/main/java/com/blah/operator/configuration/JpaDevBeanConfiguration.java
        Error:Error:line (3)ajc: The import com.blah.annotations cannot be resolved
        Error:Error:line (28)ajc: AdminServerApp cannot be resolved to a type
    /Users/bytor99999/Documents/blah/blah/blahProjects/blah/blah-core/src/main/java/com/blah/operator/configuration/JpaProdBeanConfiguration.java
        Error:Error:line (3)ajc: The import com.blah.annotations cannot be resolved
        Error:Error:line (28)ajc: AdminServerApp cannot be resolved to a type
    /Users/bytor99999/Documents/blah/blah/blahProjects/blah/blah-core/src/main/java/com/blah/operator/domain/operator/OperatorLoginLog.java
        Error:Error:line (41)ajc: Operator cannot be resolved to a type
        Error:Error:line (63)ajc: Operator cannot be resolved to a type
        Error:Error:line (64)ajc: Operator cannot be resolved to a type
        Error:Error:line (67)ajc: Operator cannot be resolved to a type
        Error:Error:line (68)ajc: Operator cannot be resolved to a type
    /Users/bytor99999/Documents/blah/blah/blahProjects/blah/blah-core/src/main/java/com/blah/operator/domain/operator/OperatorSession.java
        Error:Error:line (17)ajc: Operator cannot be resolved to a type
        Error:Error:line (31)ajc: Operator cannot be resolved to a type
        Error:Error:line (32)ajc: Operator cannot be resolved to a type
    /Users/bytor99999/Documents/blah/blah/blahProjects/blah/blah-core/src/main/java/com/blah/operator/repository/OperatorRepository.java
        Error:Error:line (3)ajc: The import com.blah.operator.domain.operator.Operator cannot be resolved
        Error:Error:line (12)ajc: Operator cannot be resolved to a type
        Error:Error:line (19)ajc: Operator cannot be resolved to a type
    Mark
    Last edited by bytor99999; Jan 17th, 2013 at 12:11 PM. Reason: remove real company names

  6. #6
    Join Date
    Jan 2009
    Location
    Huntington Beach, CA
    Posts
    718

    Default

    Now the thing that kind of surprises me is that Operator is in there, since that won't use ajc because it isn't a cross store bean. It is actually straight Spring Data Jpa using a different configuration. So when it is in a classpath running, there is no SDN beans at all.

    Mark

  7. #7
    Join Date
    Jan 2009
    Location
    Huntington Beach, CA
    Posts
    718

    Default

    So on those latest ones, I got rid of the "Error:Error:line (68)ajc: Operator cannot be resolved to a type"

    By converting the Operator class from Groovy to Java. That is a major bummer and failure on ajc to not be able to use Groovy domain classes.

    Mark

  8. #8
    Join Date
    Jan 2009
    Location
    Huntington Beach, CA
    Posts
    718

    Default

    OK, I have a solution, but it isn't a good solution. I am not sure if it is AspectJ's fault or SDN. But I had to convert every single domain class I had from being a Groovy class to Java classes. Took me a couple of hours, but I don't get those type errors anymore. I am getting an error in running the test, but a normal error

    java.lang.IllegalStateException: Flushing detached entity without a persistent state, this had to be created first.

    Which means I created a new domain object and didn't attach it to the entityManager. But only went through the repository. Will post that in another thread.

    Should we add a jira ticket on the Groovy issue?

    Thanks

    Mark

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

    Default

    Hi,

    Michael asked me to chime in on this issue. I can't speak to your most recent question but I'll comment on the need to translate from groovy>java. I don't quite speak fluent maven, so can I confirm what you are doing: compiling the groovy/java sources and then doing an AspectJ weaving step. Is that right? This should be fine as long as the groovy compiler is producing suitable output classes for your domain objects and they follow what the Spring Data aspects are looking for. It won't work any other way around because AspectJ won't understand groovy source code. When other source languages are involved, AspectJ should be used just as a bytecode weaver and operates on the compiled output of whatever compiler was used (scala, groovy, javac).

    cheers,
    Andy

  10. #10
    Join Date
    Jan 2009
    Location
    Huntington Beach, CA
    Posts
    718

    Default

    Yes, basically, unless I could figure out how to tell Maven and my IDE for that matter to compile with javac and only instrument the bytecode with ajc. Unfortunately, as it stands it is compiling and instrumenting using ajc as the compiler, which wouldn't understand the Groovy source code.

    Mark

Posting Permissions

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