Exception During Connect

108 views
Skip to first unread message

Ralph Tittensor

unread,
Feb 27, 2013, 2:05:43 PM2/27/13
to neo4j...@googlegroups.com
Hiya,

New to neo4j and neo4jclient and I'm having problems trying to connect to my db. I can verify that the DB is running correctly via the web interface. However in my C# app when I call connect I get an exception throw. I've googled for others with the problem and couldn't see any others with the same issue. 

The exception is an ArgumentException:

System.ArgumentException: Local variable doesn't belong to this frame's method.
  at Mono.Debugger.Soft.StackFrame.GetValue (Mono.Debugger.Soft.LocalVariable var) [0x0006b] in /private/tmp/source/monodevelop/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/StackFrame.cs:104 
  at Mono.Debugging.Soft.VariableValueReference.get_Value () [0x0000c] in /private/tmp/source/monodevelop/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/VariableValueReference.cs:68 
  at Mono.Debugging.Evaluation.ValueReference.OnCreateObjectValue (Mono.Debugging.Client.EvaluationOptions options) [0x00020] in /private/tmp/source/monodevelop/main/src/core/Mono.Debugging/Mono.Debugging.Evaluation/ValueReference.cs:131 
  at Mono.Debugging.Evaluation.ValueReference.CreateObjectValue (Mono.Debugging.Client.EvaluationOptions options) [0x00050] in /private/tmp/source/monodevelop/main/src/core/Mono.Debugging/Mono.Debugging.Evaluation/ValueReference.cs:106 

This looks like a mono problem but then if you have a look at the callstack:

Neo4jClient.GraphClient.SendHttpRequest (request=, commandDescription=, expectedStatusCodes=) in 
Neo4jClient.GraphClient.SendHttpRequestAndParseResultAs (Parameters=) in 
Neo4jClient.GraphClient.SendHttpRequestAndParseResultAs (Parameters=) in 
Neo4jClient.GraphClient.Connect (Parameters=) in 
PIServer.Program.Main (Parameters=) in /Users/ralpht/Projects/pi/PIServer/PIServer/Program.cs:20

It's being thrown inside the Connect function somewhere.

I'm running on a mac, with the .net 4.0 framework. The call to connect looks like:

GraphClient _client = new GraphClient(new Uri("http://localhost:7474/db/data"));

_client.Connect();


Which looks correct to me, and copy pasting the uri into my browser leads me to the rest API correctly.


Any thoughts? Is the library .net4 mono compatible? Am I going to have to write my own C# rest API client?

Cheers,

-ralph


Tatham Oddie

unread,
Feb 27, 2013, 6:36:52 PM2/27/13
to neo4j...@googlegroups.com

Hi Ralph,

 

I'm running on a mac, with the .net 4.0 framework.

 

I want to be clear here that you’re running Mono, and that is not the .NET Framework.

 

Any thoughts? Is the library .net4 mono compatible?

 

We’ve never tested against Mono, as our projects don’t use it and nobody has mentioned it prior. That’s not to say it shouldn’t work.

 

The exception is coming from our HTTP subsystem, which uses the HttpClient package from Microsoft. This is a .NET 4.5 package which uses async/await constructs.

 

Mono seems to have its own implementation of HttpClient: https://github.com/mono/mono/blob/master/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs

 

I wonder which one you’re running against, and if we need to compile against the other one or something?

 

Am I going to have to write my own C# rest API client?

 

I would suggest that that would be a very large waste of time. Instead, I’d encourage you to fork our existing source code (it’s open source), and investigate just what tweaks are required to get it running on Mono. At a minimum, you would have a working solution. Better, we could potentially integrate those changes back in and support future users on Mono too.

 

 

-- Tatham

--
You received this message because you are subscribed to the Google Groups "Neo4jClient" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4jclient...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ralph Tittensor

unread,
Feb 28, 2013, 3:56:36 AM2/28/13
to neo4j...@googlegroups.com
Thanks for the quick reply! :)

When I said .net 4.0, I meant that the version of mono that I am using is compatible with the .net 4.0 framework, not the latest 4.5. I have a version of the http client library which is compatible with .net 4.0. If you are assuming that it is the 4.5 version of the http library then maybe that is the problem?

I've forked the project and I'll see if I can get it going under mono with .net 4 compatibility. Will let you know how I get on!

Cheers,

-ralph

samrin shaikh

unread,
Aug 14, 2014, 6:17:19 AM8/14/14
to neo4j...@googlegroups.com

Hi 

New to neo4j and neo4jclient and I'm having problems trying to connect to my db. I can verify that the DB is running correctly via the web interface. However in my C# app when I call connect I get an exception throw.

   at Neo4jClient.GraphClient.SendHttpRequest(HttpRequestMessage request, String commandDescription, HttpStatusCode[] expectedStatusCodes) in c:\TeamCity\buildAgent\work\5bae2aa9bce99f44\Neo4jClient\GraphClient.cs:line 141
   at Neo4jClient.GraphClient.SendHttpRequestAndParseResultAs[T](HttpRequestMessage request, String commandDescription, HttpStatusCode[] expectedStatusCodes) in c:\TeamCity\buildAgent\work\5bae2aa9bce99f44\Neo4jClient\GraphClient.cs:line 182
   at Neo4jClient.GraphClient.SendHttpRequestAndParseResultAs[T](HttpRequestMessage request, HttpStatusCode[] expectedStatusCodes) in c:\TeamCity\buildAgent\work\5bae2aa9bce99f44\Neo4jClient\GraphClient.cs:line 177
   at Neo4jClient.GraphClient.Connect() in c:\TeamCity\buildAgent\work\5bae2aa9bce99f44\Neo4jClient\GraphClient.cs:line 191
   at Neo4J_POC.Pages.AddUser.btn_Add_Click(Object sender, EventArgs e) in d:\EDGE Next Gen\POC\Neo4J_POC\Neo4J_POC\Pages\AddUser.aspx.cs:line 46 


It's being thrown inside the Connect function somewhere.

I'm running on a window 7 , with the .net 4.5 framework & visual Studio 2012 The call to connect looks like:

GraphClient _client = new GraphClient(new Uri("http://localhost:7474/db/data"));

_client.Connect();


Which looks correct to me, even i try with my machine IP instead of localhost ...But it not working for me .

The exception is coming from our HTTP subsystem, which uses the HttpClient package from Microsoft. This is a .NET 4.5 package which uses async/await constructs. which is also install but still i ma facing the issue .

Install-Package Microsoft.Net.Http -Version 2.2.22


Can any1 help me out with my problem 


Regards

Samrin Shaikh 






Chris Skardon

unread,
Aug 14, 2014, 6:42:51 AM8/14/14
to neo4j...@googlegroups.com
What happens if you go to http://localhost:7474/db/data in your browser? Does it take you to a page entitled 'root'? What version of Neo4j are you running?

Thanks!

Chris


--
You received this message because you are subscribed to the Google Groups "Neo4jClient" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4jclient...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

samrin shaikh

unread,
Aug 14, 2014, 7:50:13 AM8/14/14
to neo4j...@googlegroups.com, cska...@xclave.co.uk
Hi Chris, 

Yes it goes to the page Titled with Root. I am not sure with the version but i think it Neo4jCommunity 2.1.2.0 .Please find the attached image of the Root page  (http://localhost:7474/db/data in my browse)

Can you please help me in resolving the issue..

Regards
Samrin
Error.png

samrin shaikh

unread,
Aug 18, 2014, 1:44:48 AM8/18/14
to neo4j...@googlegroups.com, cska...@xclave.co.uk
Hi Chris, 
 
Any luck for my issue ???
 
Regards
Samrin

Chris Skardon

unread,
Aug 18, 2014, 5:14:07 AM8/18/14
to neo4j...@googlegroups.com
I have added a comment to your StackOverflow post: http://stackoverflow.com/questions/25337531/neo4jclient-connect-issue

Cheers


samrin shaikh

unread,
Aug 18, 2014, 6:27:44 AM8/18/14
to neo4j...@googlegroups.com, cska...@xclave.co.uk
Hi Chris,

I am using version :  version="1.0.0.656"  

<package id="Neo4jClient" version="1.0.0.656" targetFramework="net45" />

 as per your comment i have try using try catch block around connect function & I have added the comment in stack flow also.

Below are the exception detail : 

ex.stacktrace :    at Neo4jClient.GraphClient.SendHttpRequest(HttpRequestMessage request, String commandDescription, HttpStatusCode[] expectedStatusCodes) in c:\TeamCity\buildAgent\work\5bae2aa9bce99f44\Neo4jClient\GraphClient.cs:line 141
   at Neo4jClient.GraphClient.SendHttpRequestAndParseResultAs[T](HttpRequestMessage request, String commandDescription, HttpStatusCode[] expectedStatusCodes) in c:\TeamCity\buildAgent\work\5bae2aa9bce99f44\Neo4jClient\GraphClient.cs:line 182
   at Neo4jClient.GraphClient.SendHttpRequestAndParseResultAs[T](HttpRequestMessage request, HttpStatusCode[] expectedStatusCodes) in c:\TeamCity\buildAgent\work\5bae2aa9bce99f44\Neo4jClient\GraphClient.cs:line 177
   at Neo4jClient.GraphClient.Connect() in c:\TeamCity\buildAgent\work\5bae2aa9bce99f44\Neo4jClient\GraphClient.cs:line 191
   at Neo4J_POC.Pages.AddUser.btn_Add_Click(Object sender, EventArgs e) in d:\EDGE Next Gen\POC\Neo4J_POC\Neo4J_POC\Pages\AddUser.aspx.cs:line 46


Please help in solving my issue I really don't knew where i am going wrong 

Regards
Samrin

Chris Skardon

unread,
Aug 18, 2014, 6:42:35 AM8/18/14
to neo4j...@googlegroups.com
I am monitoring the StackOverflow page so you don't need to reply here. 

You should respond to the questions posed by me and Michael:

1. In the code you put to this list - you have new Uri("http://localhost:7474/db/data/"); but on the stack overflow page you have: new Uri("Neo4jURL"); what is the actual code you are using.
2. Have you tried the connection in a simple Console App? Start a brand new console app, and use this as your 'Main' method:

static void Main()
{
    var client = new GraphClient(new Uri("http://localhost:7474/db/data"));
    client.Connect();
}

If you don't get an exception from this, then it's something to do with your other project.

Romiko van de dronker Derbynew

unread,
Aug 18, 2014, 6:54:23 PM8/18/14
to neo4j...@googlegroups.com

Have you got fiddler running, turn it off?  Can you connect to neo on the admin console?

samrin shaikh

unread,
Aug 19, 2014, 6:03:57 AM8/19/14
to neo4j...@googlegroups.com
Hi 

Can you suggest me how can i Turn off  Fiddler ??? 

Can you suggest me what all think / access are required to run Neo4jClient ??

Since  my machine have block downloading activities  as well as might some security/ firewall which might block ?? Is there any thing specified what all right should i have & all 

Regard

Chris Skardon

unread,
Aug 19, 2014, 6:09:01 AM8/19/14
to neo4j...@googlegroups.com
Samrin, 

1. Fiddler (http://www.telerik.com/fiddler) is an application for debugging web apps, I'm guessing you don't have it installed, in which case don't worry.

2. If you're connecting locally and have the server running (as you have indicated) then you should have all the permissions you need. You've said you can get to 'http://localhost:7474/db/data/' in a browser, so the port isn't being blocked by a firewall.

3. Have you tried creating the simple Console Application? This is as basic as it comes and will start to narrow down your problem.

Chris

samrin shaikh

unread,
Aug 19, 2014, 7:23:12 AM8/19/14
to neo4j...@googlegroups.com, cska...@xclave.co.uk
Hi 

 I tried  below lines of code in Newly created console application but still i am not able to connect to the DB  it has been more then a week I am not able to connect .

 Below are exception StackTrace details : 


  at Neo4jClient.GraphClient.SendHttpRequest(HttpRequestMessage request, String commandDescription, HttpStatusCode[] expectedStatusCodes) in c:\TeamCity\buildAgent\work\5bae2aa9bce99f44\Neo4jClient\GraphClient.cs:line 141
   at Neo4jClient.GraphClient.SendHttpRequestAndParseResultAs[T](HttpRequestMessage request, String commandDescription, HttpStatusCode[] expectedStatusCodes) in c:\TeamCity\buildAgent\work\5bae2aa9bce99f44\Neo4jClient\GraphClient.cs:line 182
   at Neo4jClient.GraphClient.SendHttpRequestAndParseResultAs[T](HttpRequestMessage request, HttpStatusCode[] expectedStatusCodes) in c:\TeamCity\buildAgent\work\5bae2aa9bce99f44\Neo4jClient\GraphClient.cs:line 177
   at Neo4jClient.GraphClient.Connect() in c:\TeamCity\buildAgent\work\5bae2aa9bce99f44\Neo4jClient\GraphClient.cs:line 191
   at ConsoleApplication1.Program.Main(String[] args) in c:\Users\10605894\Documents\Visual Studio 2012\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs:line 18

Regard

Tatham Oddie

unread,
Aug 19, 2014, 9:42:23 PM8/19/14
to neo4j...@googlegroups.com, cska...@xclave.co.uk

Please post the full exception details, including the message and type, not just the stack trace.

 

The stack trace tells us where the exception occurred but not what it was.

 

--

Tatham Oddie

Romiko van de dronker Derbynew

unread,
Aug 19, 2014, 9:48:53 PM8/19/14
to neo4j...@googlegroups.com

Create a console app and send it to me or put it on git and ill try reproduce the error

On 14/08/2014 8:17 PM, "samrin shaikh" <samrins...@gmail.com> wrote:

samrin shaikh

unread,
Aug 20, 2014, 12:35:34 AM8/20/14
to neo4j...@googlegroups.com, cska...@xclave.co.uk
Hi 

Message is : One or more errors occurred.

((ex.InnerException).InnerException).InnerException.Message: No connection could be made because the target machine actively refused it 127.0.0.1:7474

((ex.InnerException).InnerException).InnerException.StackTrace:   at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)

Regards

Romiko van de dronker Derbynew

unread,
Aug 20, 2014, 12:39:00 AM8/20/14
to neo4j...@googlegroups.com

Hi,

I dont think the issue is the graph client.  Download and install fidler and try connect to the http URL by hand rolling an http request

On 14/08/2014 8:17 PM, "samrin shaikh" <samrins...@gmail.com> wrote:

Romiko van de dronker Derbynew

unread,
Aug 20, 2014, 12:42:35 AM8/20/14
to neo4j...@googlegroups.com

Also, do a Netstat -anop tcp |findstr 7474 MAKE SURE you only got one application listening on 7474.


Then create a REST request to http://localhost:7474....



Example request




Read this


You should get this





--
Romiko Derbynew
Mobile: +61 4000 90251




Message has been deleted

Romiko van de dronker Derbynew

unread,
Aug 20, 2014, 1:11:00 AM8/20/14
to neo4j...@googlegroups.com
You trying to connect to Neo4j. Do you know how it works under the hood? If not, perhaps that is your first task.

2. When you use the graph client to connect it will do a HTTP REQUEST TO the neo4j server
3. 
4. The server will respond with  data in JSON
5. So, you can test this yoruself. DOWNLOAD FIDDLER. and create an HTTP GET Request to http://localhost:7474/db/data/, if that does not work, then you got another issue.

6. DID you follow my advice and check if other services are using port 7474? open a command prompt an check.

If you going to develop, you need to at least understand or attempt to understand fundamentals of a process. NEo4j uses http to connect and send commands to. So, try connect it to it directly on http without the graphclient so we can see if it is the graphclient or not.

I feel the above is more than enough to get you going in the right direction. Let me know two things.

1. Are there any other processes on the machine using port 7474? Besided Neo4j?  netstat -anop tcp |findstr 74747
2. Make sure Neo4j is running before you run your application, before the code to CONNECT RUNS!   
3. Make sure Neo4j is running, and then try use Fiddler to query the server

The above is something you can do, so please do it, and then reply. 


On Wed, Aug 20, 2014 at 3:03 PM, samrin shaikh <samrins...@gmail.com> wrote:
Hi 

I didn't get you . can you please explain in detail what i need ??

Regard

Romiko van de dronker Derbynew

unread,
Aug 20, 2014, 1:20:49 AM8/20/14
to neo4j...@googlegroups.com
The exception you posted has the details in it, on why the error occurs:
((ex.InnerException).InnerException).InnerException.Message: No connection could be made because the target machine actively refused it 127.0.0.1:7474

As I mentioned. Follow my steps in the previous post. Either you got issues with firewalls, another program using 7474, or when you run the code, Neo4j is not running and listening on port 7474.....

Make sure neo4j is running then run this on your machine and send me the output:
netstat -anop tcp |findstr 7474

Install fiddler, create an http GET request and set the HTttp header to (Accept: application/json; charset=UTF-8), then execute it.

I am waiting for you to do these two things.

samrin shaikh

unread,
Aug 20, 2014, 4:53:53 AM8/20/14
to neo4j...@googlegroups.com
Hello 

I started my Neo4j in browser & the run the below command at cmd prompt . Please find both the image . 

I am new to fiddler Can you suggest how to do the following thing : 

create an http GET request and set the HTttp header to (Accept: application/json; charset=UTF-8), then execute it.


Regards
7474.png
Neo4j.png

Romiko van de dronker Derbynew

unread,
Aug 20, 2014, 5:20:27 AM8/20/14
to neo4j...@googlegroups.com
So you only have one process listening on port 7474/ This is good. 

There is fiddler documentation on how to create the most simplest of requests http get. Read this:


Its the most simplest developer tool in regards to http. Let me know how that goes. If you should be able to figure out fiddler.

samrin shaikh

unread,
Aug 21, 2014, 5:06:16 AM8/21/14
to neo4j...@googlegroups.com
Hi Romiko ,
 
 I have try the create an HTTP GET request in simple web application . Please find the attached Image for response that i got ..

 1 more question is there something downloaded / connect to web (which might block at firewall ) that when we start connecting using connect method.
 
 Can you suggest where i am going wrong in connecting to Neo4j.

 
Regards
samrin
GET HTTP Response.png

Romiko van de dronker Derbynew

unread,
Aug 21, 2014, 7:11:33 AM8/21/14
to neo4j...@googlegroups.com

Hi,

I need the http respone text,  few lines down.

Or have you got TeamViewer?  I can remote into your box and help you.

samrin shaikh

unread,
Aug 21, 2014, 7:31:52 AM8/21/14
to neo4j...@googlegroups.com
Hi 

Please find the attached doc for the http response details. 

Sorry I don't have Team viewer. if you can share me the solution that run properly at you end we can check whether the same application throw the exception or not  ??


Regards
Samrin 
GET HTTP Response.docx

samrin shaikh

unread,
Aug 22, 2014, 12:41:59 AM8/22/14
to neo4j...@googlegroups.com

Hi
 
Any Luck ??
...
Message has been deleted

samrin shaikh

unread,
Aug 25, 2014, 9:00:13 AM8/25/14
to neo4j...@googlegroups.com
Hi Romiko ,

Any update where I am going wrong ? still i am not able to figure out the solution .....  

Can anyone  help me out with my problem of connect function :(


Regards
Samrin 
Reply all
Reply to author
Forward
0 new messages