This past weekend I spent most of my time trying to get my dev environment mostly setup and knowlege polished up. One of the thing is to build the Neo4j (it is the by far the most popular and leading graph database) source code on my machine and study internal how it works, mostly because i would like to get myself prepared at the projects from my work that are extensively dealing and analyzing with billion of data nodes currently in the production environments and of course, if i have time, i would like to make some bug fixes and enchancment contributions to its repositority. Well, anyway, as always, the best way to get a feel how a thing works is to watch how a piece of data coming in and out -> Yes, the debugger again! In this article I will give a tutorial how to set this up on the Neo4j server community version on my local.
(Note that in order to get the most out from this tutorial, it is assumed that you have already had some basic idea of using Neo4j and its WebAdmin tools. I strongly encourage you to spend some time to take a look at their developer site and learn it now: http://neo4j.com/developer/guide-neo4j-browser/)
Step 1) Download the Neo4j Community Edition (2.1.5 as of today) at http://neo4j.com/download/ and follow the instrcutions to extract it.
Step 2) Assuming it is extracted to the /usr/local/neo4j-community-2.1.5, open the conf/neo4j-wrapper.conf file and add the following line:
wrapper.java.additional=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=y
Step 3) Download the Neo4j source codes from its GitHub account at https://github.com/neo4j/neo4j.git
git clone https://github.com/neo4j/neo4j.git
Step 4) (Recommended) Since the Neo4j version i downloaded in above was 2.1.5., in order to make the source code consistent to the one i downloaded in step 1, I need to switch the working branch to 2.1 maint as well by issuing the following command:
git checkout -b 2.1-maint origin/2.1-maint
Note that the 2.1-maint was from their github site:
Step 5) Now import all Neo4j source codes (actually they are all the maven projects) into the Eclipse
Step 6) In Eclipse, create the remote debug configuration and has it listen to the port 5005 in which we specified in Step 2
Step 7) Run the configuration that you just created in Step 6)
Step 8) Now we can set the break point anywhere. Let say we set it at the JmxService.java’s getBean() method and if we go to the http://localhost:7474/webadmin
We should have the the script paused as below: