2017-02-14 46 views
2

我连接的Neo4j社区-3.1.1非本地服务器这样的:Neo4j的螺栓通过的Neo4j-Java的应用程序连接卡住

Driver driver = GraphDatabase.driver("bolt://10.209.20.211:7687", 
      AuthTokens.basic("username", "xxxx")); 
    System.out.println("neo4j driver created.."); 
    Session session = driver.session(); 
    System.out.println("session opened.."); 

但它永远无法达到“的System.out.println( “会议开幕..”);“显然,它在“driver.session();”时卡住了,

我敢肯定,网络是工作,我已经通过“telnet 10.209.20.211 7687”测试。

而且neo4j.conf文件是这样的:

#***************************************************************** 
    # Network connector configuration 
    #***************************************************************** 

    # With default configuration Neo4j only accepts local connections. 
    # To accept non-local connections, uncomment this line: 
    dbms.connectors.default_listen_address=0.0.0.0 

    # You can also choose a specific network interface, and configure a non-default 
    # port for each connector, by setting their individual listen_address. 

    # The address at which this server can be reached by its clients. This may be the server's IP address or DNS name, or 
    # it may be the address of a reverse proxy which sits in front of the server. This setting may be overridden for 
    # individual connectors below. 
    #dbms.connectors.default_advertised_address=localhost 

    # You can also choose a specific advertised hostname or IP address, and 
    # configure an advertised port for each connector, by setting their 
    # individual advertised_address. 

    # Bolt connector 
    dbms.connector.bolt.enabled=true 
    #dbms.connector.bolt.tls_level=OPTIONAL 
    #dbms.connector.bolt.listen_address=:7687 

    # HTTP Connector. There must be exactly one HTTP connector. 
    dbms.connector.http.enabled=true 
    #dbms.connector.http.listen_address=:7474 

现在,有什么问题呢?

+0

它的怪异,我从来没有见过这样的概率,它应该工作。你在本地尝试吗?您可以尝试使用本地“密码外壳”客户端连接到远程服务器 – logisima

+0

感谢您的回复。 – nemo

回答

0

我用下面的代码解决此问题:

Config cfg = Config.build().withEncryptionLevel(Config.EncryptionLevel.NONE).toConfig(); 
Driver driver = GraphDatabase.driver("bolt://10.209.20.211:7687", 
     AuthTokens.basic("username", "xxxx"), cfg); 
System.out.println("neo4j driver created.."); 
Session session = driver.session(); 
System.out.println("session opened.."); 
相关问题