JavaEar 专注于收集分享传播有价值的技术资料

Cannot access child value on Newtonsoft.Json.Linq.JValue during Neo4jConnection

I've set up my neo4j connection but is not working but rather throwing the error:

Cannot access child value on Newtonsoft.Json.Linq.JValue.

This is Neo4j ninject module file:

public class Neo4jModule : NinjectModule
{
    /// <summary>Loads the module into the kernel.</summary>
    public override void Load()
    {
        Bind<IGraphClient>().ToMethod(InitNeo4JClient).InSingletonScope();
    }

    private static IGraphClient InitNeo4JClient(IContext context)
    {
        var neo4JUri = new Uri("http://www.example.com");
        var graphClient = new GraphClient(neo4JUri, "username", "password");
        graphClient.Connect();

        return graphClient;
    }
}

This is my RegisterServices method for my Ninject.Web.Common file:

private static void RegisterServices(IKernel kernel)
    {
        kernel.Load<Neo4jModule>();
    }  

I don't understand why i am getting this error. This exception is caught at:

graphClient.Connect();

I also debugged my application and realised that the graphclient object upon creation comes with many errors. Can anyone help me?

1个回答

    最佳答案
  1. The whole wasn't faulty. The error came from my uri to the GraphClient object. For example http://localhost:7474/ is wrong url.The correct and accepted url is http://localhost:7474/db/data.

    var neo4JUri = new Uri("http://www.example.com/db/data");
    

    That's all there is the connection working.