zode64 zode64 - 4 months ago 52x
Java Question

How to debug an unmanaged server extension in Neo4j3

How can I debug the unmanaged server extensions in Neo4j 3.

I have quite a complicated plugin which I'm migrating from Neo4j 2 to Neo4j 3.

When I add the plugin to the plugin folder and start Neo4j after several seconds I see a message

Starting Neo4j failed: org.neo4j.server.web.NeoServletContainer-20bef39e@312b9bee==org.neo4j.server.web.NeoServletContainer,-1,false

I see more or less the same logs I see with an example extension that actually worked. You can see the logs here https://github.com/whatsthebeef/neo4j-test/blob/master/log2.txt

Are there any tricks?


Yes! \o/

So, let’s get to the bottom of this: Neo4j is just a big Java application.


  1. Add neo4j-harness to your project.
  2. Configure In-Process Neo4j server.
  3. Add your extension there.
  4. Start everything.

After this, you can debug your extension and Neo4j itself as standard Java application.


I will copy code sample from docs here, just to have all information in one place:

serverControls = TestServerBuilders.newInProcessBuilder()
            .withExtension(EXTENSION_MOUNT_POINT, ResourcesRootMarker.class)
// EXTENSION_MOUNT_POINT - where to mount your extension, e.g. - "/myextension"
// ResourcesRootMarker.class - this class is located in the same package with JAX-RS resources