neo4j/neo4j-ogm-quarkus

Neo4J OGM - Missing Dependencies

Closed this issue · 2 comments

I started a new quarkus project from scratch and integrated neo4j-ogm-quarkus in the current version.

When starting the application following stacktrace appears:

java.lang.RuntimeException: Failed to start quarkus at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source) at io.quarkus.runtime.Application.start(Application.java:101) at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:111) at io.quarkus.runtime.Quarkus.run(Quarkus.java:71) at io.quarkus.runtime.Quarkus.run(Quarkus.java:44) at io.quarkus.runtime.Quarkus.run(Quarkus.java:124) at io.quarkus.runner.GeneratedMain.main(Unknown Source) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:113) at java.base/java.lang.Thread.run(Thread.java:1583) Caused by: java.lang.NoClassDefFoundError: io/micrometer/context/ContextSnapshotFactory at java.base/java.lang.Class.getDeclaredFields0(Native Method) at java.base/java.lang.Class.privateGetDeclaredFields(Class.java:3473) at java.base/java.lang.Class.getDeclaredFields(Class.java:2542) at org.neo4j.ogm.metadata.FieldsInfo.<init>(FieldsInfo.java:57) at org.neo4j.ogm.metadata.ClassInfo.<init>(ClassInfo.java:139) at org.neo4j.ogm.metadata.ClassInfo.<init>(ClassInfo.java:119) at org.neo4j.ogm.metadata.DomainInfo.lambda$addClass$2(DomainInfo.java:172) at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1228) at org.neo4j.ogm.metadata.DomainInfo.addClass(DomainInfo.java:172) at org.neo4j.ogm.metadata.DomainInfo.create(DomainInfo.java:98) at org.neo4j.ogm.metadata.MetaData.<init>(MetaData.java:65) at org.neo4j.ogm.session.SessionFactory.<init>(SessionFactory.java:124) at org.neo4j.ogm.session.SessionFactory.<init>(SessionFactory.java:110) at org.neo4j.ogm.quarkus.runtime.Neo4jOgmRecorder.initializeSessionFactory(Neo4jOgmRecorder.java:64) at io.quarkus.deployment.steps.Neo4jOgmProcessor$createSessionFactory1383093778.deploy_0(Unknown Source) at io.quarkus.deployment.steps.Neo4jOgmProcessor$createSessionFactory1383093778.deploy(Unknown Source) ... 11 more Caused by: java.lang.ClassNotFoundException: io.micrometer.context.ContextSnapshotFactory at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:518) at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:468) ... 27 more

When adding the missing library some more exceptions about more and more missing libs will apear.

For reproducing just start a project with the quarkus quickstart.

Wow, I found the solution to fix this by studying the Integration Test project.

When I add:

org.neo4j.ogm.base-packages

to the application properties the error won't occur. Maybe you should try to reproduce this behaviour and fix it in feature releases.

Thanks for reporting this.

You must configure a mapping package, that is correct.

There are no dependencies missing, unless you excluded them.
It's just that Quarkus tries to load everything that is ever referred to by default, and in essence behaves a bit different than many other JVM programs. Little I can do here.