rogermushroom
rogermushroom

Reputation: 5586

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?

Upvotes: 0

Views: 163

Answers (2)

rogermushroom
rogermushroom

Reputation: 5586

FylmTM's answer got me moving.

The other thing worth noting is that for some reason (on my version at least) the neo4j.log file was at this location

~/Library/Application\ Support/Neo4j\ Community\ Edition/logs/neo4j.log

Where as the other logs are in the logs dir.

Upvotes: 0

FylmTM
FylmTM

Reputation: 2007

Yes! \o/

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

Recipe:

  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.

Links:

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)
            .newServer();
// 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

Upvotes: 2

Related Questions