Experiencing a null pointer exception upon database schema initialization

schema

(Tristan957) #1

I am actually using DropWizard and Neo4j's OGM. The repository is here https://github.com/Return0Software/fwf-server. The problematic lines are https://github.com/Return0Software/fwf-server/blob/master/src/main/java/com/github/return0software/fwf/domain/edges/Membership.java#L13 and https://github.com/Return0Software/fwf-server/blob/master/src/main/java/com/github/return0software/fwf/domain/edges/Follow.java#L13. When either of those two lines are uncommented, I receive the following error:

ERROR [2018-12-16 18:36:39,446] io.dropwizard.cli.ServerCommand: Unable to start server, shutting down
! java.lang.NullPointerException: null
! at org.neo4j.ogm.metadata.schema.DomainInfoSchemaBuilder.getNodeByTypeDescriptor(DomainInfoSchemaBuilder.java:145)
! at org.neo4j.ogm.metadata.schema.DomainInfoSchemaBuilder.getNodeByFieldAndContainingClass(DomainInfoSchemaBuilder.java:139)
! at org.neo4j.ogm.metadata.schema.DomainInfoSchemaBuilder.buildRelationships(DomainInfoSchemaBuilder.java:90)
! at org.neo4j.ogm.metadata.schema.DomainInfoSchemaBuilder.build(DomainInfoSchemaBuilder.java:50)
! at org.neo4j.ogm.metadata.MetaData.<init>(MetaData.java:47)
! at org.neo4j.ogm.session.SessionFactory.<init>(SessionFactory.java:98)
! at org.neo4j.ogm.session.SessionFactory.<init>(SessionFactory.java:82)
! at com.github.return0software.fwf.managed.Neo4jSessionFactoryManager.start(Neo4jSessionFactoryManager.java:19)
! at io.dropwizard.lifecycle.JettyManaged.doStart(JettyManaged.java:27)
! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
! at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:138)
! at org.eclipse.jetty.server.Server.start(Server.java:419)
! at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117)
! at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
! at org.eclipse.jetty.server.Server.doStart(Server.java:386)
! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
! at io.dropwizard.cli.ServerCommand.run(ServerCommand.java:53)
! at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:44)
! at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:87)
! at io.dropwizard.cli.Cli.run(Cli.java:78)
! at io.dropwizard.Application.run(Application.java:93)
! at com.github.return0software.fwf.App.main(App.java:22)
! at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
! at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
! at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
! at java.lang.reflect.Method.invoke(Method.java:498)
! at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:282)
! at java.lang.Thread.run(Thread.java:748)

Every other relationship is working fine on server startup. It makes me think if I will have issues at runtime with the other relationships. I believe that the problem is a misunderstanding of the OGM on my part. I will be combing over documentation today to see what I can find.

Along with that, when you have a relationship that is a List or Set do you initialize both sides of the relationship? How does this example code know when to actually initialize the Sets https://neo4j.com/docs/ogm-manual/current/tutorial/#tutorial:annotations:relationships?


(Tristan957) #2

I did read that undirected relationships cannot be of different types so I have fixed that now, but still getting the same errors


(Tristan957) #3

You ever get that feeling where you are the stupidest person on planet Earth? That is me. I had the wrong imported User type. This issue can now be effectively closed.


(Michael Hunger) #4