Search code examples
amazon-ec2neo4jrmi

No command response from neo4j-shell, despite establishing connection


Created new EC2 instance of neo4j via CloudFormation template found here (ubuntu host). https://github.com/neo4j-contrib/ec2neo

Got the web interface to work fine, and DB is up and running.

Trying to connect with neo4j-shell from my local dev machine, and I am able to establish a connection to the remote EC2 server.

$ neo4j-shell -host ec2-xx-xx-xx-xx.compute-1.amazonaws.com

Welcome to the Neo4j Shell! Enter 'help' for a list of commands
NOTE: Remote Neo4j graph database service 'shell' at port 1337

neo4j-sh (?)$

netstat confirms that a connection has been ESTABLISHED

tcp6 0 0 xx.xx.xx.xx:1337 my.local.ip.add:13785 ESTABLISHED

At this point, I type help, or any neo4j command, and I get no response back from the server. The console just hangs. As soon as I stop the neo4j service on the server, I get the following exception on the client console.

java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is: 
    java.io.EOFException
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:229)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:162)
    at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:194)
    at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:148)
    at com.sun.proxy.$Proxy1.interpretLine(Unknown Source)
    at org.neo4j.shell.impl.AbstractClient.evaluate(AbstractClient.java:149)
    at org.neo4j.shell.impl.AbstractClient.evaluate(AbstractClient.java:133)
    at org.neo4j.shell.impl.AbstractClient.grabPrompt(AbstractClient.java:101)
    at org.neo4j.shell.StartClient.grabPromptOrJustExecuteCommand(StartClient.java:383)
    at org.neo4j.shell.StartClient.startRemote(StartClient.java:330)
    at org.neo4j.shell.StartClient.start(StartClient.java:196)
    at org.neo4j.shell.StartClient.main(StartClient.java:135)
Caused by: java.io.EOFException
    at java.io.DataInputStream.readByte(DataInputStream.java:267)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:215)
    ... 11 more

I have made the following change to neo4j-wrapper.conf :

wrapper.java.additional=-Djava.rmi.server.hostname=ec2-xx-xx-xx-xx.compute-1.amazonaws.com

All iptables are "disabled", to eliminate variables. I am able to run neo4j-shell on the server itself, to 127.0.0.1

What am I missing in my network config or neo4j server config?


Solution

  • Try to ssh into the instance and run it there. remote connections have been a pain for a long time because of the underlying Java RMI port handling.

    You can also try out cycli which supports http and auth.