Neo4j (or indeed other applications) may be configured to initialise on certain IP:Port combinations. If either part of this network address is already bound to another process, the application initialisation is likely to fail, reporting errors similar to the following:
Failed to bind TCP to [0.0.0.0:5000] due to: Bind failed because of java.net.BindException: Address already in use
It is necessary to identify the process already binding the address and then reconfigure or terminate that process or reconfigure Neo4j to initialise on a different address.
Identifying Other Binded Process
On mac OS, we can use the
lsof command to identify the process id with which a particular IP:Port combination is bound, e.g. as shown below:
Above shows that a process with process-id (pid) of 597 is currently binding the localhost:5000 address. Next, we can identify the application associated with the process ID identified above by using the
ps command, e.g. as shown below:
Above shows the local installation path of the application associated with process ID 597.
Similar tools and commands can be used to achieve this on Linux, Windows and other operating systems, e.g. netstart, eventvwr, etc.
One of the following can be used to overcome this issue.
Terminate the Other Process
In the above example process ID 597 could be terminated, thus freeing up port 5000 for Neo4j. This should be done with caution as it would affect any application that is using said process.
Configure Neo4j to use a different port
Neo4j can be configured to use different ports, the following documentation describes the default ports used and how to change them: