Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java &引用;不再支持此语法(缺少的属性现在返回为null)";运行SpringRestGraphDatabase时_Java_Neo4j_Spring Data Neo4j - Fatal编程技术网

Java &引用;不再支持此语法(缺少的属性现在返回为null)";运行SpringRestGraphDatabase时

Java &引用;不再支持此语法(缺少的属性现在返回为null)";运行SpringRestGraphDatabase时,java,neo4j,spring-data-neo4j,Java,Neo4j,Spring Data Neo4j,我已经获取了示例应用程序“gs-accessing-data-neo4j”,并尝试将其定制为使用Rest服务器 我已设法使其启动并运行,并且可以看到数据进入数据库,但我发现以下错误: "Caused by: org.neo4j.rest.graphdb.RestResultException: This syntax is no longer supported (missing properties are now returned as null). (line 1, colum

我已经获取了示例应用程序“gs-accessing-data-neo4j”,并尝试将其定制为使用Rest服务器

我已设法使其启动并运行,并且可以看到数据进入数据库,但我发现以下错误:

"Caused by: org.neo4j.rest.graphdb.RestResultException: This syntax is no longer supported       (missing properties are now returned as null). (line 1, column 72)
"START `person`=node:__types__(className="hello.Person") WHERE `person`.`name`! = {0} RETURN `person`"
                                                                        ^ at"
我怀疑这可能是因为我的POM中的依赖项之间不匹配,但我已经检查了一遍又一遍,据我所知,应该可以:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.springframework</groupId>
    <artifactId>gs-accessing-data-neo4j</artifactId>
    <version>0.1.0</version>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>0.5.0.M6</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-neo4j-rest</artifactId>
            <version>2.3.3.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.neo4j</groupId>
            <artifactId>neo4j</artifactId> 
            <version>2.0.0-M06</version>
        </dependency> 
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-neo4j</artifactId>
            <version>2.3.3.RELEASE</version>
        <!-- 
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-context</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-tx</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-aspects</artifactId>
                </exclusion>
            </exclusions>
        -->
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>http://repo.spring.io/libs-milestone</url>
        </repository>
        <repository>
            <id>neo4j-release-repository</id>
            <name>Neo4j Maven 2 release repository</name>
            <url>http://m2.neo4j.org/content/repositories/releases/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>http://repo.spring.io/libs-milestone</url>
        </pluginRepository>
    </pluginRepositories>

</project>

收到任何帮助或建议

您在这里遇到版本冲突

您正在使用的Spring数据Neo4j版本(2.3.3)应该与Neo4j 1.9.x兼容


Spring Data Neo4j 3.0将与Neo4j 2.0兼容。

效果非常好!!非常感谢你的帮助
package hello;

import java.io.File;

import org.neo4j.graphdb.Transaction;
import org.neo4j.kernel.EmbeddedGraphDatabase;
import org.neo4j.kernel.impl.util.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.neo4j.config.EnableNeo4jRepositories;
import org.springframework.data.neo4j.config.Neo4jConfiguration;
import org.springframework.data.neo4j.core.GraphDatabase;
import org.springframework.data.neo4j.rest.SpringRestGraphDatabase;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;


@Configuration
@EnableNeo4jRepositories
public class Application extends Neo4jConfiguration implements CommandLineRunner {

//    @Bean
//    EmbeddedGraphDatabase graphDatabaseService() {
//        return new EmbeddedGraphDatabase("accessingdataneo4j.db");
//    }


@Bean
SpringRestGraphDatabase graphDatabaseService() {
    return new SpringRestGraphDatabase("http://localhost:7474/db/data");
}


@Autowired
PersonRepository personRepository;

@Autowired
GraphDatabase graphDatabase;

public void run(String... args) throws Exception {
    Person greg = new Person("Greg");
    Person roy = new Person("Roy");
    Person craig = new Person("Craig");

    System.out.println("Before linking up with Neo4j...");
    for (Person person : new Person[]{greg, roy, craig}) {
        System.out.println(person);
    }

    Transaction tx = graphDatabase.beginTx();
    try {
        personRepository.save(greg);
        personRepository.save(roy);
        personRepository.save(craig);

        greg = personRepository.findByName(greg.name);
        greg.worksWith(roy);
        greg.worksWith(craig);
        personRepository.save(greg);

        roy = personRepository.findByName(roy.name);
        roy.worksWith(craig);
        // We already know that roy works with greg
        personRepository.save(roy);

        // We already know craig works with roy and greg

        tx.success();
    } finally {
        tx.finish();
    }

    System.out.println("Lookup each person by name...");
    for (String name: new String[]{greg.name, roy.name, craig.name}) {
        System.out.println(personRepository.findByName(name));
    }

    System.out.println("Looking up who works with Greg...");
    for (Person person : personRepository.findByTeammatesName("Greg")) {
        System.out.println(person.name + " works with Greg.");
    }
}

public static void main(String[] args) throws Exception {
    FileUtils.deleteRecursively(new File("accessingdataneo4j.db"));

    SpringApplication.run(Application.class, args);
}

}