cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

NoSuchMethodError deep inside BoltDriver

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.
2X_7_70a1368c7d25785dd5e3cf0cde363f50e6857f64.png
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 ??
2X_b_b17054973f2374bed7d48b6628410fcd7caa54a4.png

Thanks in advance

12 REPLIES 12

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.

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

  1. your earlier observation re conflicting multiple drivers (1.7.5 & 4.0.1) was spot on - many thanks.
  2. Unfortunately that revealed another exception - ExceptionIninitializerError.
  3. 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.
  4. I have attached a pdf showing some screen shots of debug sessions.
  5. I have also zipped up the corresponding Eclipse project so you can try it yourself. It is attached.
  6. 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)

(Attachment trial.zip is missing)

Thanks for the detailed analysis. Could you please attach those files (again?)

Hi Gerrit - which files - the pdf & zip that got rejected or the bundle of txt and png files??

Hi Gerrit - which files - the pdf & zip that got rejected or the bundle of txt and png files??

cheers
Rod

2X_3_317fdcf9582aba33e6989326d7f2fac2832ed656.png | gerrit.meier Gerrit Meier Neo4j Staff
May 3 |

  • | - |

2X_7_79df27ca1ae82f3c09e600aaa7bd8ca73eaf0270.pngrcbs0357:

(Attachment Synopsis of Neo4j OGM problem.pdf is missing)

(Attachment trial.zip is missing)

Thanks for the detailed analysis. Could you please attach those files (again?)


Visit Topic or reply to this email to respond.


In Reply To

2X_7_71ddcda5f5d3098d6584c1081bc13bebffa07bf1.png | rcbs0357
May 3 |

  • | - |

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…


Visit Topic or reply to this email to respond.

To unsubscribe from these emails, click here.

(Attachment Synopsis of Neo4j OGM problem.pdf is missing)

(Attachment trial.zip is missing)

Hi Gerrit,

Try again - this time with just png and text files.

Instead of the pdf you have...Synopsis of Neo4j OGM problem - page 1 through to Synopsis of Neo4j OGM problem - page 7

Instead of the zipped Eclipse project you have...

Class1.java.txt

Class2.java.txt

DomainmodelFactory.java.txt

FactoryInterface.java.txt

Neo4JSessionFactory.java.txt

stuff.java.txt

pom.xml.txt

logback-test.xml.txt

POM_Dependencies.png

trial_Project_package_Structure.png

cheers Rod.

Class1.java.txt (1.11 KB)

DomainmodelFactory.java.txt (1.25 KB)

FactoryInterface.java.txt (211 Bytes)

Class2.java.txt (818 Bytes)

Neo4JSessionFactory.java.txt (630 Bytes)

stuff.java.txt (757 Bytes)

pom.xml.txt (2.41 KB)

logback-test.xml.txt (614 Bytes)

2X_f_fe1a0b31d2cca351598e0f2c762252fe118c0596.png

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

Many thanks

Take a closer look at org.neo4j.ogm.session.SessionFactory.java#232 SessionFactory.unwrap()

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

  1. your earlier observation re conflicting multiple drivers (1.7.5 & 4.0.1) was spot on - many thanks.
  2. Unfortunately that revealed another exception - ExceptionIninitializerError.
  3. 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.
  4. I have sent a pdf (showing some screen shots of debug sessions.) to your mail addr.
  5. I have also zipped up the corresponding Eclipse project so you can try it yourself. Again sent via email.
  6. 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.

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.

Thank you Gerrit - that was the problem - a case of me weaving tangled webs when first practising OGM.

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online