When I try to use Hibernate ogm and spring boot the console gives “Could not instantiate named strategy class” error

前端 未结 2 572
遥遥无期
遥遥无期 2021-01-28 16:10

I tried to connect hibernate ogm,Spring boot and mongodb.I used jpa for my development. So I selected Hibernate ogm... When I try to run the application the console gives below

相关标签:
2条回答
  • 2021-01-28 16:47

    I don't use Spring Boot but JBoss WildFly 11/12 with MongoDB. I had problems getting started. By ensuring I was using the latest version of Hibernate, OGM & Elastic Search etc. fixed it for me.

    From your log:

    Caused by: java.lang.NoSuchMethodException: org.hibernate.ogm.datastore.mongodb.MongoDBDialect.()

    Shows mismatch of version numbers.

    0 讨论(0)
  • 2021-01-28 16:59

    The version of OGM you are using (4.0.0.Beta4) is way too old considering the version of Hibernate ORM you are using (5.0.11.Final). You should use compatible versions, because OGM depends on Hibernate ORM.

    If you want to use ORM 5.0.11.Final, then you should use OGM 5.0.4.Final. I would recommend upgrading to more recent versions, though; 5.0 is already one year and a half old and several versions have been published since it was first released.

    Be careful though, the version number of OGM generally does not match the version number of ORM. For compatibility of more recent versions of OGM with ORM, see http://hibernate.org/ogm/releases/#compatibility-matrix.

    0 讨论(0)
提交回复
热议问题