neo4j server-extension example - java.net.BindException:地址已在使用中

时间:2015-03-23 20:12:01

标签: java maven neo4j jersey

我正在浏览在github上发布的neo4j服务器扩展示例---当运行mvn包时,我得到了MovieServiceIntegrationTest上端口7474的“java.net.BindException:Address in in use”。 / p>

我通过命令'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)

用netstat:

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                  *.* 

2 个答案:

答案 0 :(得分:0)

看起来你在运行maven测试时运行了neo4j实例。确保在运行maven之前关闭它。

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

答案 1 :(得分:0)

我刚刚重新启动计算机,瞧!它起作用了!