Hi
I'm developing an app using Neo4j 3.5.14 database and Neo4j-OGM. Whilst developing the POC i hand crafted the CRUD operations using Cypher and the java driver 1.7.5. It worked fine. Now as we move to formalising the app we want to exploit Neo4j-ogm.
The Maven based dependencies we have created for the project are as below.
Very early in the app execution we are getting this exception (see below) being thrown from deep inside the driver. Any bright ideas about the cause of this ??
This looks like a classpath problem coming from a duplicated java driver dependency in different versions.
As you can see in the exception log there are some internal calls going on in the driver. From the changes in the driver, I can see that the method was introduced in the 4.0 version and is not available in the 1.7 line of the driver.
The list in eclipse looks pretty ok, so I would suggest doing a mvn dependency:tree on your project and looking at the neo4j-java-driver versions.
Firstly - many thanks for your swift response - really appreciated.
I have run an mvn dependency tree against the project and i do NOT see a smoking gun.
The output is attached. as you can see the only neo4j-java-driver is 4.0.1.
Hi, well I think i found part of the problem - the project had a dependant project in the build path andthat dependant project was built with 1.7.5.
I've cleaned that up and observed that maven is no longer trying to drag 1.7.5 into the local repo.
BUT..
there is still a problem in the same area of code though the exception has now changed to "ExceptionInInitializerError".
Of course setting up the SessionFactory via the Configuration based constructor is just 1 possibility - i could try the existing Driver route - however i run into a different problem there.
If I make the Driver of type org.neo4j.ogm.driver.Driver then the construction of the sessionFactory is happy but the initialisation of the Driver is not happy.
If I make the Driver of type org.neo4j.driver.Driver; then the construction of the sessionFactory is not happy but the initialisation of the Driver is happy.
Casting between the 2 types of driver is not possible. The ogm documentation implies that i should be able to construct using the existing driver (i.e org.neo4j.driver.Driver) but I cannot seem to find that overloaded version of the constructor.
So i am in a bit of a double bind and any suggestions would be gratefully received
Hi Gerrit,
ignore my earlier posts. I have done some more digging and can now identify what i think is the root cause.
In summary
your earlier observation re conflicting multiple drivers (1.7.5 & 4.0.1) was spot on - many thanks.
Unfortunately that revealed another exception - ExceptionIninitializerError.
Eventually i stripped everything away from my app to find the root cause. It appears to be whenever I have a referenced class in any of the annotated entities.
I have sent a pdf (showing some screen shots of debug sessions.) to your mail addr.
I have also zipped up the corresponding Eclipse project so you can try it yourself. Again sent via email.
I have read and re-read the OGM documentation so i hope have have not made a silly mistake - apologies in advance if i have.
cheers Rod.
Hi Gerrit,
ignore my earlier posts. I have done some more digging and can now identify what i think is the root cause.
In summary
your earlier observation re conflicting multiple drivers (1.7.5 & 4.0.1) was spot on - many thanks.
Unfortunately that revealed another exception - ExceptionIninitializerError.
Eventually i stripped everything away from my app to find the root cause. It appears to be whenever I have a referenced class in any of the annotated entities.
I have attached a pdf showing some screen shots of debug sessions.
I have also zipped up the corresponding Eclipse project so you can try it yourself. It is attached.
I have read and re-read the OGM documentation so i hope have have not made a silly mistake - apologies in advance if i have.
cheers Rod.
(Attachment Synopsis of Neo4j OGM problem.pdf is missing)
Hi Gerrit, ignore my earlier posts. I have done some more digging and can now identify what i think is the root cause. In summary your earlier observation re conflicting multiple drivers (1.7.5 & 4.0.1) was spot on - many thanks. Unfortunately that revealed another exception - ExceptionIninitial…
You are accessing Neo4JSessionFactory#createNeo4JSession before it was completely initialized.
Starting with the new SessionFactory in this class, Neo4j-OGM begins to scan for entities and encounters Class2 with the static field of type DomainmodelFactory and its initialization call.
The DomainmodelFactory needs the Session mySession field that gets set via Neo4JSessionFactory.createNeo4JSession(). This access returns null because the initialization process is not yet completed. Your code is still in the first step and as a consequence the graphSessionFactory in Neo4JSessionFactory is not yet set.
To solve this, you should really avoid using all those static references in your code.