简体   繁体   中英

Neo4J Browser ServiceUnavailable failure after connecting with Neo4J Java driver

I regularly use Neo4J Browser on http://localhost:7474/browser/ . However, yesterday I used the java driver to connect to Neo4J and execute queries. Since then, I'm unable to login to Neo4J Browser.

I start Neo4J from the terminal (I'm on ubuntu) using sudo neo4j start , and this is the output -

 % sudo neo4j start
Active database: graph.db
Directories in use:
  home:         /var/lib/neo4j
  config:       /etc/neo4j
  logs:         /var/log/neo4j
  plugins:      /var/lib/neo4j/plugins
  import:       /var/lib/neo4j/import
  data:         /var/lib/neo4j/data
  certificates: /var/lib/neo4j/certificates
  run:          /var/run/neo4j
Starting Neo4j.
WARNING: Max 1024 open files allowed, minimum of 40000 recommended. See the Neo4j manual.
/usr/share/neo4j/bin/neo4j: line 411: /var/run/neo4j/neo4j.pid: No such file or directory

Then, I visit localhost:7474 , which gives me the :server connect screen, but as soon as I enter the password, I get this error -

ServiceUnavailable: WebSocket connection failure. Due to security constraints in your web browser, the reason for the failure is not available to this Neo4j Driver. Please use your browsers development console to determine the root cause of the failure. Common reasons include the database being

Screenshot -

在此处输入图片说明

Normally, the only authentication fields are "Username" and "Password". I don't think I've seen the "Host" field in there before.

I searched for this error, and came across a question with similar error and an article on the Neo4J KB that says -

In Neo4j 3.0 and its implementation of the Bolt protocol, if a remote browser connects to Neo4j (http://:7474) and attempts to authenticate, the following error may be encountered:

But I don't think this situation applies here.

How can I fix this?

As logisima pointed out, neo4j is not compatible with Java 9. You can install multiple versions of Java and use environment variables to swap between them. For instance on MacOS you might have these two lines in your .bash_profile

export JAVA_HOME=$(/usr/libexec/java_home)
export JAVA8_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home

The first line gets your normally installed java home and the second points to the older java8 location.

Then before starting your neo4j instance, execute for example:

export JAVA_HOME=$JAVA8_HOME
$NEO4J_HOME/bin/neo4j start

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM