neo4j 服务器扩展示例——java.net.BindException:地址已在使用中

neo4j server-extension example -- java.net.BindException: Address already in use

我正在查看 github 中 pos 的 neo4j 服务器扩展示例——当 运行 mvn 包时,我得到 "java.net.BindException:Address already in use" 用于 MovieServiceIntegrationTest 上的端口 7474。

我已经通过命令 'lsof -i:7474' 和 'netstat -n' 查看了端口,但没有发现任何干扰。

我也试过 linux(最初是在 os X 上),我遇到了同样的问题。

下一步调查错误的最佳步骤是什么?

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running example.extension.movies.MovieServiceIntegrationTest
server.baseUri() = http://localhost:7474/
05:46:21.067 [main] WARN  o.e.j.server.handler.ContextHandler - o.e.j.s.ServletContextHandler@29314cc9{/,null,null} contextPath ends with /
05:46:21.070 [main] WARN  o.e.j.server.handler.ContextHandler - Empty contextPath
05:46:21.078 [main] INFO  org.eclipse.jetty.server.Server - jetty-9.0.5.v20130815
05:46:21.133 [main] INFO  o.e.j.server.handler.ContextHandler - Started o.e.j.s.h.MovedContextHandler@7b208b45{/,null,AVAILABLE}
Mar 23, 2015 5:46:21 AM com.sun.jersey.api.core.PackagesResourceConfig init
INFO: Scanning for root resource and provider classes in the packages:
  example.extension.movies
Mar 23, 2015 5:46:21 AM com.sun.jersey.api.core.ScanningResourceConfig logClasses
INFO: Root resource classes found:
  class example.extension.movies.MovieResource
Mar 23, 2015 5:46:21 AM com.sun.jersey.api.core.ScanningResourceConfig init
INFO: No provider classes found.
Mar 23, 2015 5:46:21 AM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.9 09/02/2011 11:17 AM'
05:46:21.588 [main] INFO  o.e.j.server.handler.ContextHandler - Started o.e.j.s.ServletContextHandler@ba354ca{/movie,null,AVAILABLE}
Mar 23, 2015 5:46:21 AM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.9 09/02/2011 11:17 AM'
05:46:21.757 [main] INFO  o.e.j.server.handler.ContextHandler - Started o.e.j.s.ServletContextHandler@7b4acdc2{/db/manage,null,AVAILABLE}
Mar 23, 2015 5:46:21 AM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.9 09/02/2011 11:17 AM'
05:46:21.957 [main] INFO  o.e.j.server.handler.ContextHandler - Started o.e.j.s.ServletContextHandler@736048ed{/db/data,null,AVAILABLE}
05:46:22.061 [main] INFO  o.e.j.w.StandardDescriptorProcessor - NO JSP Support for /browser, did not find org.apache.jasper.servlet.JspServlet
05:46:22.078 [main] INFO  o.e.j.server.handler.ContextHandler - Started o.e.j.w.WebAppContext@64693226{/browser,jar:file:/Users/brianchase/.m2/repository/org/neo4j/app/neo4j-browser/2.1.4/neo4j-browser-2.1.4.jar!/browser,AVAILABLE}
Mar 23, 2015 5:46:22 AM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.9 09/02/2011 11:17 AM'
05:46:22.191 [main] INFO  o.e.j.server.handler.ContextHandler - Started o.e.j.s.ServletContextHandler@29314cc9{/,null,AVAILABLE}
05:46:22.251 [main] WARN  o.e.j.u.component.AbstractLifeCycle - FAILED ServerConnector@3f985a86{HTTP/1.1}{localhost:7474}: java.net.BindException: Address already in use
java.net.BindException: Address already in use

调查端口(监听7474个neo4j服务器):

Computer:~ user$ lsof -i:7474
COMMAND PID       USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
java    421 user  137u  IPv6 0x4c075845f5b86ccd      0t0  TCP localhost:7474 (LISTEN)

网络统计:

Active Internet connections
Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)    
tcp4       0      0  192.168.44.208.49303   65.115.96.238.80       SYN_SENT   
tcp4       0      0  192.168.44.208.49301   209.197.20.103.80      ESTABLISHED
tcp4       0      0  192.168.44.208.49300   4.31.28.74.80          ESTABLISHED
tcp4     164      0  192.168.44.208.49276   52.0.233.188.80        CLOSE_WAIT 
tcp4       0      0  192.168.44.208.49208   108.160.170.34.80      ESTABLISHED
tcp4      37      0  192.168.44.208.49186   108.160.165.211.443    CLOSE_WAIT 
tcp4      37      0  192.168.44.208.49185   108.160.165.211.443    CLOSE_WAIT 
tcp4      37      0  192.168.44.208.49184   108.160.165.211.443    CLOSE_WAIT 
tcp4      37      0  192.168.44.208.49183   108.160.165.211.443    CLOSE_WAIT 
tcp4       0      0  192.168.44.208.49178   17.172.233.120.5223    ESTABLISHED
tcp4       0      0  192.168.44.208.49177   17.110.227.101.5223    ESTABLISHED
tcp4      37      0  192.168.44.208.49170   108.160.166.141.443    CLOSE_WAIT 
udp4       0      0  *.58920                *.*                               
udp4       0      0  *.17500                *.*                               
udp4       0      0  *.53249                *.*                               
udp4       0      0  192.168.44.208.123     *.*                               
udp6       0      0  fe80::2ef0:eeff:.123   *.*                               
udp6       0      0  fe80::8402:97ff:.123   *.*                               
udp6       0      0  fe80::1%lo0.123        *.*                               
udp4       0      0  127.0.0.1.123          *.*                               
udp6       0      0  ::1.123                *.*                               
udp6       0      0  *.123                  *.*                               
udp4       0      0  *.123                  *.*                               
udp6       0      0  *.5353                 *.*                               
udp4       0      0  *.5353                 *.*                               
udp4       0      0  *.*                    *.*                               
udp4       0      0  *.58003                *.*                               
udp4       0      0  *.*                    *.*                               
udp4       0      0  *.*                    *.*                               
udp4       0      0  *.*                    *.*                               
udp4       0      0  *.*                    *.*                               
udp6       0      0  *.5353                 *.*                               
udp4       0      0  *.*                    *.*                               
udp4       0      0  *.*                    *.*                               
udp4       0      0  *.*                    *.*                               
udp4       0      0  *.*                    *.*                               
udp4       0      0  *.*                    *.*                               
udp4       0      0  *.*                    *.*                               
udp6       0      0  *.5353                 *.*                               
udp4       0      0  *.5353                 *.*                               
udp46      0      0  *.*                    *.*                               
udp4       0      0  *.*                    *.*                               
udp4       0      0  *.*                    *.*                               
udp4       0      0  *.*                    *.*                               
udp4       0      0  *.*                    *.*                               
udp4       0      0  *.*                    *.*                               
udp4       0      0  *.*                    *.*                               
udp4       0      0  *.*                    *.*                               
udp4       0      0  *.*                    *.*                               
udp4       0      0  *.*                    *.*                               
udp46      0      0  *.*                    *.*                               
udp4       0      0  *.*                    *.*                               
udp4       0      0  *.*                    *.*                               
udp4       0      0  *.137                  *.*                               
udp4       0      0  *.138                  *.* 

当 运行 Maven 测试时,您似乎有一个 neo4j 实例 运行。确保在 运行 maven 之前关闭它。

在运行mvn之前,使用jps列出所有运行java进程。 neo4j 进程在 jps 的列表中被称为 Bootstrapper。确保没有这个进程。

我刚刚重新启动了计算机,瞧!成功了!