Java 发布提交时使用SDN4 404

Java 发布提交时使用SDN4 404,java,spring-test,cucumber-jvm,spring-data-neo4j-4,Java,Spring Test,Cucumber Jvm,Spring Data Neo4j 4,我正在尝试为我的SpringWeb应用程序创建一些测试。我有一些使用MockMvc的测试类和一个使用Selenium的Cucumber测试类。所有测试都执行连接到InProcessServer实例的CRUD操作 当使用Gradle运行测试时,MockMvc测试类运行并通过,但当Cucumber测试步骤执行时,我得到以下信息: 2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 >> "POST /db/da

我正在尝试为我的SpringWeb应用程序创建一些测试。我有一些使用MockMvc的测试类和一个使用Selenium的Cucumber测试类。所有测试都执行连接到InProcessServer实例的CRUD操作

当使用Gradle运行测试时,MockMvc测试类运行并通过,但当Cucumber测试步骤执行时,我得到以下信息:

2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 >> "POST /db/data/transaction/commit HTTP/1.1[\r][\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 >> "Content-Type: application/json;charset=UTF-8[\r][\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 >> "Accept: application/json;charset=UTF-8[\r][\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 >> "User-Agent: neo4j-ogm.java/1.0[\r][\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 >> "Content-Length: 131[\r][\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 >> "Host: localhost:7478[\r][\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 >> "Connection: Keep-Alive[\r][\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 >> "Accept-Encoding: gzip,deflate[\r][\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 >> "[\r][\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 >> "{"statements":[{"statement":"MATCH (n:`User`) RETURN COUNT(n)","parameters":{},"resultDataContents":["row"],"includeStats":false}]}"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 << "HTTP/1.1 404 Not Found[\r][\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 << "Date: Thu, 17 Sep 2015 15:44:05 GMT[\r][\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 << "Cache-Control: must-revalidate,no-cache,no-store[\r][\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 << "Content-Type: text/html; charset=ISO-8859-1[\r][\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 << "Content-Length: 304[\r][\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 << "Server: Jetty(9.2.4.v20141103)[\r][\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 << "[\r][\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 << "<html>[\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 << "<head>[\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 << "<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>[\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 << "<title>Error 404 </title>[\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 << "</head>[\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 << "<body>[\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 << "<h2>HTTP ERROR: 404</h2>[\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 << "<p>Problem accessing /db/data/transaction/commit. Reason:[\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 << "<pre>    Not Found</pre></p>[\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 << "<hr /><i><small>Powered by Jetty://</small></i>[\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 << "</body>[\n]"
2015-09-17 16:44:05 DEBUG org.apache.http.wire - http-outgoing-3 << "</html>[\n]"
2015-09-17 16:44:05 INFO  o.s.d.n.config.Neo4jConfiguration - Intercepted exception
编辑:


我现在唯一能想到的是,当使用Selenium运行测试时,TestServer没有正确(或及时)启动。你能提供更多关于被截获的异常的信息吗?为什么它要发布到/db/data/transaction而不是http://:port?@luane,因为这是正确的http。主机:部分决定服务器地址/端口Neo4jConfiguration是如何设置的?@luane Config class已添加。由于JUnit测试工作正常,这可能是一个
jvm
问题。我现在唯一能想到的是,当使用Selenium运行测试时,TestServer没有正确启动(或及时启动)。你能提供更多关于被截获的异常的信息吗?为什么它要发布到/db/data/transaction而不是http://:port?@luane,因为这是正确的http。主机:部分决定服务器地址/端口Neo4jConfiguration是如何设置的?@luane Config class已添加。这可能是一个问题,因为JUnit测试工作正常。
2015-09-17 16:44:04 INFO  o.s.b.c.e.j.JettyEmbeddedServletContainer - Jetty started on port(s) 37837 (http/1.1)
@Configuration
@EnableNeo4jRepositories(basePackages = "co.sens.data.repositories")
@EnableTransactionManagement
@ComponentScan("co.sens.data")
public class Neo4jTestConfiguration extends Neo4jConfiguration {
    @Override
    public SessionFactory getSessionFactory() {
        return new SessionFactory("co.sens.data");
    }

    @Bean
    @Override
    public Neo4jServer neo4jServer() {
        return new InProcessServer();
    }

    @Override
    @Bean
    public Session getSession() throws Exception {
        return super.getSession();
    }
}