Bruno Tomas
Bruno Tomas

Reputation: 21

Neo4j server not starting

Today my Neo4j server went down. When I tried to start it again, I got the following error from PowerShell:

 PS C:\Users\brunotomas> 'E:\neo4j' | Start-Neo4jServer
Start-Service : Service 'Neo4j-Server (Neo4j-Server)' cannot be started due to the following error: Cannot start servic
e Neo4j-Server on computer '.'.
At E:\neo4j\bin\Neo4j-Management\Start-Neo4jServer.ps1:142 char:30
+       $result = Start-Service <<<<  -Name $ServiceName -PassThru
    + CategoryInfo          : OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service],
   ServiceCommandException
    + FullyQualifiedErrorId : CouldNotStartService,Microsoft.PowerShell.Commands.StartServiceCommand  

Then I uninstalled it and tried to reinstall it to see if it fixes. Apparently it creates the service, but doesn't start the service, like before.

When I try to start the service through "Services" on Windows, I get the following error:

Windows could not start the Neo4j-Server service on Local Computer.
Error 1053: The service did not respond to the start or control request in a timely fashion.

I've tried everything I could to solve this, without success. Does anybody have any clues about what might be causing this problem? I'm running Neo4j 2.3.2 on a Windows 2008 server.

EDIT: Just a couple more info that I found today: Event Viewer shows a timeout reached when I try to start service:

A timeout was reached (60000 milliseconds) while waiting for the Neo4j-Server service to connect.

When tried to start server on console, it throws the following Exception

PS C:\Users\brunotomas> 'E:\neo4j' | Start-Neo4jServer -Console -Wait
Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't obtain class com.sun.jna.CallbackReference.AttachOption
s
        at com.sun.jna.Native.initIDs(Native Method)
        at com.sun.jna.Native.<clinit>(Native.java:115)
        at com.sun.jna.Structure.<clinit>(Structure.java:132)
        at org.rzo.yajsw.WindowsXPProcess.start(WindowsXPProcess.java:1474)
        at org.neo4j.wrapper.ServerProcessConsole.doStart(ServerProcessConsole.java:45)
        at org.neo4j.wrapper.ServerProcess.<init>(ServerProcess.java:115)
        at org.neo4j.wrapper.ServerProcessConsole.<init>(ServerProcessConsole.java:31)
        at org.neo4j.wrapper.NeoServiceWrapper.launchAsConsoleApp(NeoServiceWrapper.java:48)
        at org.neo4j.wrapper.NeoServiceWrapper.main(NeoServiceWrapper.java:35)
1

Upvotes: 1

Views: 6683

Answers (3)

chaltahai
chaltahai

Reputation: 117

I am running neo4j on windows and in my case the crux of the issue was that there was an incompatibility between the installed versions of Java (32-bit) v/s OS version. The biggest clue that led me to this is the following set of lines in neo4j-service.2018-08-03 log file

[2018-08-03 14:55:42] [info] [ 1432] Starting service... [2018-08-03 14:55:42] [error] [ 1432] %1 is not a valid Win32 application. [2018-08-03 14:55:42] [error] [ 1432] Failed creating java C:\JavaNew\bin\server\jvm.dll [2018-08-03 14:55:42] [error] [ 1432] %1 is not a valid Win32 application. [2018-08-03 14:55:42] [error] [ 1432] ServiceStart returned 1

There are a fair number of potential issues, and I have made an attempt to compile all the issues with this,

Windows services cannot deal with service names in folders that have spaces; especially if there is another folder with the same name as the one with spaces. For example - C:\Program Files... will have issues if C:\Program\Something...

To work around this, I put Neo4j in root folder c:\Neo4j

Get-Java.ps1 (under ..\bin\Neo4j-Management folder)looks in the path variable for 'JAVA_HOME' (usually found in *nix environments). If it does not find it here, it keeps looking in registry, and finally throws up its hand!

To deal with this, I simply put in a path variable. For a good measure, I uninstalled Java and re-installed Java in the root folder under C:\JavaNew

In retrospect, this step is probably not on part of the problem, and hence can be ignored. But I am leaving it here for completeness sake.

Invoke-Neo4j.ps1 (also under ..\bin\Neo4j-Management folder) has code that determines if the OS is 32-bit (or 64-bit). Based on this it determines if it should run prunsrv-i386.exe (32-bit) or prunsrv-amd64.exe (64-bit).

This has to match the Java version installed.

Upon running java -XshowSettings:all, and inspecting the sun.arch.data.model value (32, in my case), I realized that my OS is 64 bit and the Java version is 32-bit.

To deal with this, I put in code (very klugey!). I am sure there are much better ways to get to the same outcome, but this is what I used.

switch ( (Get-WMIObject -Class Win32_Processor | Select-Object -First 1).Addresswidth ) { 32 { $PrunSrvName = 'prunsrv-i386.exe' } # 4 Bytes = 32bit #64 { $PrunSrvName = 'prunsrv-amd64.exe' } # 8 Bytes = 64bit COMMENTED as a workaround!!! 64 { $PrunSrvName = 'prunsrv-i386.exe' } # 8 Bytes = 64bit

Now, uninstall the neo4j service, install it, and start the service.

Hope this works for you.

Upvotes: 0

Bruno Tomas
Bruno Tomas

Reputation: 21

The solution was quite simple, but a little hard to find out.

Another application was using it's own JNA DLLs and Neo4j was loading them.

Just removed the conflicting reference from PATH and it works.

Upvotes: 1

Michael Hunger
Michael Hunger

Reputation: 41706

Did your java version perhaps update under your feet? Looks rather like something related to a version incompatibility. Or did any cleanup process delete sth? Best to try to reinstall the same Neo4j version and point it to your db again.

Upvotes: 0

Related Questions