Announcement Announcement Module
Collapse
No announcement yet.
Spring Data Graph + Eclipse + AJDT : Editor errors Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Data Graph + Eclipse + AJDT : Editor errors

    Hi to all Graphistas,

    First of all I want to congratulate all the the developers of SDG - version 1.1 has added a lot of functionality, especially in terms of querying (Cypher, Gremlin etc).

    Now to the problem, Summary : Eclipse editor reports errors such as
    Type mismatch : Cannot convert from Class<XXX> to Class<? extends RelationshipBacked>
    or
    The method relateTo(World, String) is undefined for the type

    Its is an old problem that's been mentioned a lot

    http://forum.springsource.org/showth...sist-undefined
    http://forum.springsource.org/showth...-Graph-in-real & http://stackoverflow.com/questions/7...ph-and-eclipse
    http://forum.springsource.org/showthread.php?110204-Spring-Data-Graph-Example-(cineasts)-Related-blues-amp-how-to-run
    http://forum.springsource.org/showth...sing-RelatedTo
    http://forum.springsource.org/showth...h-with-eclipse
    http://forum.springsource.org/showth...ing-Data-graph


    Having spent the last couple of days trying every possible solution, I can assure you it has not been solved!

    I 've created a JIRA issue (https://jira.springsource.org/browse/DATAGRAPH-104) inahope that the appropriate springers can rectify it...

    To sum it up:

    a) In @RelatedToVia & @RelatedTo & @NodeEntity annotations, you get something like : Type mismatch : Cannot convert from Class<XXX> to Class<? extends RelationshipBacked>

    b) In
    relateTo(...) , getRelationshipTo(), persist() and all other introduced methods, you get a
    The method relateTo(World, String) is undefined for the type XXX
    or
    The method persist() is undefined for the type XXX
    etc

    c) Finally in repository definitions like
    Code:
    public interface XXXRepository extends GraphRepository<XXX>, NamedIndexRepository<XXX> {}

    you get:
    Bound mismatch: The type XXX is not a valid substitute for the bounded parameter <T
    extends GraphBacked<?>> of the type NamedIndexRepository<T>

    Bound mismatch: The type XXX is not a valid substitute for the bounded parameter <T
    extends GraphBacked<?>> of the type GraphRepository<T>

    Remedies (with no cure)
    a) The method with adding **/*.aj to the build path
    (mentioned in https://jira.springsource.org/browse/DATAGRAPH-39 and elsewhere including par 18.1.1 in http://static.springsource.org/sprin...ing-model.html)
    DOES NOT work.

    It seems that it does, cause once you add **/*.aj as the the build path inclusion, your *.java files are not included in your build path anymore!
    Therefore, ALL errors in those *.java files aren't reported & the editor functionality is hammered (no refactoring etc).
    Now, trying to also add **/*.java to the include build path, reveals that the problem persists):-(

    b) Updating Eclipse tools to the latest versions & configuring them is not verified to cure anything - check bellow :

    Configurations

    I have used various configurations that had the exact problem, my current is :
    - Eclipse 3.7 Indigo (
    Version: 3.7.0, Build id: I20110613-1736) on a Windows 2003 VM with 4GB RAM and the following plugin versions :
    AspectJ Development Tools 2.2.0.e37x-20110907-1500
    AspectJ Development Tools (AJDT) Source Code 2.2.0.e37x-20110907-1500
    Eclipse Weaving Service Feature 2.2.0.e37x-20110907-1500
    Equinox Weaving SDK 1.0.100.v20110502-79-F8PEVVFNNFsFV
    Maven Integration for Eclipse (Required) 0.12.1.20110112-1712
    Maven Integration for WTP (Optional) 0.12.0.20110421-1500
    Project configurators for commonly used maven plugins (temporary) 0.12.0.20101103-1500
    Spring IDE AJDT Integration (optional) 2.7.1.201107082359-RELEASE
    Spring IDE AOP Extension (optional) 2.7.1.201107082359-RELEASE
    Spring IDE Autowire Extension (optional) 2.7.1.201107082359-RELEASE
    Spring IDE Batch Extension (optional) 2.7.1.201107082359-RELEASE
    Spring IDE Core (required) 2.7.1.201107082359-RELEASE
    Spring IDE Integration, Flex and Web Services Extension (optional) 2.7.1.201107082359-RELEASE
    Spring IDE Mylyn Integration (optional) 2.7.1.201107082359-RELEASE
    Spring IDE OSGi Extension (optional) 2.7.1.201107082359-RELEASE
    Spring IDE Security Extension (optional) 2.7.1.201107082359-RELEASE
    Spring IDE Web Flow Extension (optional) 2.7.1.201107082359-RELEASE
    SpringSource Tool Suite (required) 2.7.1.201107091000-RELEASE
    SpringSource Tool Suite dm Server Tools 2.7.1.201107091000-RELEASE
    SpringSource Tool Suite Maven Support 2.7.1.201107091000-RELEASE
    SpringSource Tool Suite Roo Support 2.7.1.201107091000-RELEASE
    SpringSource Tool Suite tc Server Tools 2.7.1.201107091000-RELEASE
    SpringSource Tool Suite Tutorials 2.7.1.201107091000-RELEASE
    SpringSource Tool Suite VMware Integration 2.7.1.201107091000-RELEASE


    My Maven (3.0.3) pom has the following versions :
    <spring.version>3.0.5.RELEASE</spring.version>
    <aspectj.version>1.6.12.M1</aspectj.version> (also tried M2)
    <slf4j.version>1.6.1</slf4j.version>
    <datastore-graph.version>1.1.0.RELEASE</datastore-graph.version> (same problems with SDG 1.0.0.RELEASE)

    Eclipse & Tools Configuration
    Tried various possible Eclipse / plugin settings:
    -
    Preferences -> JDT Weaving -> on & off (default) & reindexed
    - Preferences -> AspectJ Compiler
    -> Incremental Compiler Optimizations on & off(default)
    - Preferences -> Spring (used defaults)

    Projects compile & run
    I've verified the same exists problem on at least

    - Spring Data Graph examples like hello-worlds (https://github.com/SpringSource/spri...graph-examples)
    - Cineast (
    git://github.com/jexp/cineasts.git)

    and my own apps.
    Important : these apps compile fine with eclipse build and maven test. They also run fine.
    But there are the following Spring related warnings [WARNING] this affected type is not exposed to the weaver: org.neo4j.cineasts.domain.Person [Xlint:typeNotExposedToWeaver]
    [WARNING] this affected type is not exposed to the weaver: org.neo4j.cineasts.domain.Movie [Xlint:typeNotExposedToWeaver]
    [WARNING] this affected type is not exposed to the weaver: org.neo4j.cineasts.domain.Role [Xlint:typeNotExposedToWeaver]
    [WARNING] this affected type is not exposed to the weaver: org.neo4j.cineasts.domain.User [Xlint:typeNotExposedToWeaver]
    [WARNING] this affected type is not exposed to the weaver: org.neo4j.cineasts.domain.Rating [Xlint:typeNotExposedToWeaver]

    [WARNING] advice defined in org.springframework.orm.jpa.aspectj.JpaExceptionTr anslatorAspect has not been applied [Xlint:adviceDidNotMatch]
    [WARNING] advice defined in org.springframework.scheduling.aspectj.AbstractAsy ncExecutionAspect has not been applied [Xlint:adviceDidNotMatch]
    [WARNING] advice defined in org.springframework.data.neo4j.support.node.Neo4jN odeBacking has not been applied [Xlint:adviceDidNotMatch]
    [WARNING] advice defined in org.springframework.data.neo4j.support.node.Neo4jN odeBacking has not been applied [Xlint:adviceDidNotMatch]
    [WARNING] advice defined in org.springframework.data.neo4j.support.node.Neo4jN odeBacking has not been applied [Xlint:adviceDidNotMatch]
    [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:adviceDidNotMatch]
    [WARNING] advice defined in org.springframework.mock.staticmock.AbstractMethod MockingControl has not been applied [Xlint:adviceDidNotMatch]
    [WARNING] advice defined in org.springframework.data.neo4j.support.relationshi p.Neo4jRelationshipBacking has not been applied [Xlint:adviceDidNotMatch]
    [WARNING] advice defined in org.springframework.data.neo4j.support.relationshi p.Neo4jRelationshipBacking has not been applied [Xlint:adviceDidNotMatch]
    Last edited by anodynos; Sep 14th, 2011, 02:54 PM.

  • #2
    Hi,

    you could try my test project: https://github.com/dozed/neo4j-test
    There are instructions on how to import it in eclipse.

    Here my setup:
    Eclipse Version: 3.7.0 Build id: I20110613-1736
    AJDT 2.2.0.e37x-20110907-1500
    M2E - Maven Integration for Eclipse

    Regards,
    Stefan

    Comment


    • #3
      Sorry for all that fuss and thanks for your efforts so far. I'm very sad about those repeated issues.

      I forwarded your problems to Andy Clement the AJ project lead. He certainly has more insights in that than any of us

      Cheers

      Michael

      Comment


      • #4
        I tried that test project and I end up with some compile errors from just running "mvn clean test".

        Seeing a few errors like this
        ajdt-tests/neo4j-test/src/main/java/org/noorg/fink/neo4j/test/entities/Page.java:[14,31] incompatible types
        [ERROR] found : java.lang.Class<org.noorg.fink.neo4j.test.entities .Page>
        [ERROR] required: java.lang.Class<? extends org.springframework.data.neo4j.core.NodeBacked>
        Do you get a clean compile?

        Also, saw the note where you run "mvn eclipse:eclipse". I don't recommend that since the eclipse plugin isn't fully compatible with m2eclipse that is used in STS. Just import maven project from STS.

        -Thomas

        Comment


        • #5
          Andy Clement commented at your JIRA issue.

          Hope that helps.

          Michael

          Comment


          • #6
            Same here - I imported https://github.com/dozed/neo4j-test and followed Stefan's instructions : eclipse errors persist.
            Also it doesn't build with "mvn test". It gives the same naive errors like :

            Code:
            ERROR \GITHome\git\neo4j-test\src\main\java\org\noorg\fink\neo4j\test\entities
            \Page.java:[14,31] incompatible types
            found   : java.lang.Class<org.noorg.fink.neo4j.test.entities.Page>
            required: java.lang.Class<? extends org.springframework.data.neo4j.core.NodeBack
            ed>

            Comment


            • #7
              Try the following:

              % mvn -DskipTests clean aspectj:compile compile package

              Seems that the AspectJ Maven plugin doesnt get active. (The tests are supposed to fail atm.)

              trisberg: for eclipse:eclipse, see my comments and the diff on the JIRA issue.
              Last edited by StefanOllinger; Sep 16th, 2011, 07:07 AM.

              Comment


              • #8
                Stefan, I dont understand : have you made the SDG errors disappear from Eclipse editor? In your example project the problem is still there IMHO.

                The problem we talk about is not compiling & running an SDG app in general or with maven; its only about the Eclipse editor errors on SDG annotations and introduced methods.

                Comment


                • #9
                  There are problems with maven and with eclipse.

                  - Maven: aspectj:compile does not get executed
                  The solution here is to specifically execute the aspectj:compile goal.

                  - Eclipse: AspectJ plugin does not weave the aspects in
                  Here you need to run the eclipse:eclipse goal, then refresh the project in Eclipse. That works for me at least and creates a working eclipse project.

                  Regards,
                  Stefan

                  Comment


                  • #10
                    Stefan thanks - I think it's kind of workable after running "mvn eclipse:eclipse" once, it makes the errors go away, for a while...

                    After some edits / runs, they come back andyou have to rebuild. EDIT: you have to restart eclipse, re build, re-something along with voodoo and it might work! Then run aspectj:compile and it got bad again.. it wont even build / run tests on eclipse...
                    Thank god there is the command line that works!

                    Can you provide directions if you've managed to automate these goals running within eclipse ?

                    My "Project > Properties > Maven > Lifecycle Mapping" has "process-resources resources:testResources" as goals to invoke on changes.
                    I tried to introduce aspectj:compile between them, but doesnt seem to work...

                    Any ideas ?
                    Last edited by anodynos; Sep 16th, 2011, 05:40 PM.

                    Comment


                    • #11
                      Sorry, i cant really say why the errors re-appear. What you can try is to find out if any eclipse artifacts change (.project, .classpath, .settings). For example create a git repository in your project and after each change do a commit. That way you can see all deltas, if there are any.
                      Last edited by StefanOllinger; Sep 19th, 2011, 05:21 PM.

                      Comment


                      • #12
                        is there a recommended way to develope SDG applications with an IDE? I am also having all sorts of errors, using both STS 2.7.2 and STS 2.8.0.M2.

                        In either case, I have to make my @NodeEntity class implement NodeBacked, else the repository complains. If I do this, my @NodeEntity class complains that I'm not implementing required methods. Project is setup as a Maven & AspectJ project in STS.

                        I'd really like to use SDG & Neo, but these tooling errors are a real time waster. How are people using this project right now? Are you foregoing code completion etc & building using a text editor?

                        Comment


                        • #13
                          How did you set up the maven project? As you can see in some of the previous posts. maven eclipse:eclipse forgets to add the aspectj-files/paths to the build-path so it can't find the actual aspects.

                          When I opened existing sample applications with m2eclipse I didn't run into issues. But I'll re-check.

                          Thanks for the feedback

                          Michael

                          Comment


                          • #14
                            I just checked it with STS 2.7.1, 2.7.2 and 2.8.0.M2 using Import -> Maven -> Existing Maven Maven Project and imported the SDG HelloWorld project, there were no editor errors at all.

                            Please make sure that Project Properties -> AspectJ Build -> Aspect Path should contain two entries, first spring-aspects from the springframework and the spring-data-neo4j jars.

                            Attachment Attachment
                            Attached Files

                            Comment


                            • #15
                              The project was created from scratch in STS using New > Maven Project. I then added the various SDG dependencies, and copy & pasted in the maven-aspectj-plugin configuration section. I've checked the Aspect Path & the 2 JARs are there.

                              I should note that things seem to have sort resolved themselves, though I'm not quite sure why. To try verify the issue, I imported all the sample projects using Import > Existing Maven Projects. And, yes, they seemed to import fine & show no errors. After that, my project also showed no errors, though this is probably a co-incidence: I had restarted the IDE inbetween to install some updates. Note those updates weren't AJDT or anything like that. I later removed JDK 1.7 and JDK 1.5 JREs out of baseless suspicion, but I think it was working already before that.

                              Now my project looks good in the IDE, and I can compile it with a Maven Build run configuration, as long as I specify goals: clean aspectj:compile install (i.e. need to explicitly call aspectj:compile before compile, package or install). By the way, the advice to "add **/*.aj file to build path" is not really relevant to a general project. I read the JIRA issue, and it was a response based on an assumption that someone was having trouble building the Spring Data Graph project itself. I don't see an *.aj files in my project at all, and I assume that any aspects in SDG or core Spring are made available by having the JARs on the Aspect Path.

                              I'll try go back to a completely empty workspace & start a completely new Maven project to see if I can recreate the problems. One thing about the sample apps I noticed is they depend on 1.0.0 release of SDG. Again, haven't had time to see if that makes a difference (i'm using 1.1.0 release).

                              Thanks for your help, I'll get back to you if I can recreate the issue in a sandbox setup.

                              Comment

                              Working...
                              X