0

Please, help with the next issue, thank you. I am in a need to make changes in an old project, but problem is in that I even cann't to start the app. I have the next problem.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException:
 Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

caused by

org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

caused by 

org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to resolve name [org.hibernate.spatial.dialect.mysql.MySQLSpatial5InnoDBDialect] as strategy [org.hibernate.dialect.Dialect]

This only from the end of a problem. Whole error description you can find in a file "problem from intellij terminal.txt" here https://drive.google.com/drive/folders/14QZvGvUGkGp116Q2ENLywG3nziqJyp2J?usp=sharing

Also by the same link you'll find there files "application properties.txt" and "pomxml.txt"

Please, feel free to ask anything else )

General Grievance
  • 4,555
  • 31
  • 31
  • 45
  • Either incompatible versions of Hibernate and Hibernate Spatial, or Hibernate Spatial isn't on the class path and you are using the wrong dialect. – M. Deinum Sep 14 '21 at 06:24
  • Thank you, what is correct dialect? –  Sep 14 '21 at 13:57
  • How to figure out versions are compatible or not? Thank you –  Sep 14 '21 at 13:59
  • Read the documentation, generally for Hibernate jars the versions have to align. – M. Deinum Sep 14 '21 at 17:34
  • Thank you. Could be problem in SSLHandshakeException? Maybe problem is in server bug, often called "version intolerance" ? And I'm looking for place in my project where I can write smth like : System.setProperty("https.protocols", "TLSv1"); –  Sep 15 '21 at 07:31
  • I doubt that is the cause, i also don't see the error here. Please provide the information about versions and/or provide a more detailed log. Currently there is too little information (apart from the versioning). – M. Deinum Sep 15 '21 at 07:40
  • Also your pom doesn't include anything Hibernate Spatial related (and you should remove the `hibernate-entitymanager` dependency (already pulled in through `spring-boot-starter-data-jpa` and remove the `version` from `spring-boot-starter-test`. So either you aren't using hibernate spatial and you need to use a regular MySql dialect (the one that is commented in your `application.properties`) or you need to add `hibernate-spatial` as a dependency to use it. However it is totally unclear if you are or aren't using Hibernate Spatial at all. – M. Deinum Sep 15 '21 at 07:44
  • I moved from java 11 to 8. –  Sep 15 '21 at 11:08
  • And I changed the url to spring.datasource.url=jdbc:mysql://localhost:3306/fds?useUnicode=yes&characterEncoding=UTF-8&allowPublicKeyRetrieval=true&useSSL=false –  Sep 15 '21 at 11:09
  • And also I added version to the dependency mysql-connector-java 5.1.49 –  Sep 15 '21 at 11:10
  • And the moment I have only one last error, which you can find by the same link in file "last error.txt" –  Sep 15 '21 at 11:11
  • And I added other pom.xml file with name "pomxml only one error.txt" which has current dependencies –  Sep 15 '21 at 11:16
  • Please don't let us click some obscure links, meddle through files etc. just provide the information in your question. – M. Deinum Sep 15 '21 at 11:22
  • You still have the same error, so not sure what has improved (but again please add all relevant information in the question not as links to links to files). Use the proper dialect (as mentioned before) you are either using an old one (not in the jar you included) or the name/package has changed. Apparently you are using an "old" application, that should have worked from the start, so you didn't just start with an old application but broke things whilst upgrading/moving to spring boot. – M. Deinum Sep 15 '21 at 11:24
  • Finally it have started locally. I removed " spring.jpa.database-platform=org.hibernate.spatial.dialect.mysql.MySQLSpatial5InnoDBDialect". And I added "spring.jpa.properties.hibernate.dialect=org.hibernate.spatial.dialect.mysql.MySQL56InnoDBSpatialDialect". And one dependency: org.hibernate hibernate-core 5.4.15.Final –  Sep 15 '21 at 11:56

1 Answers1

0

As code was written few years ago, then:

  • I moved from java 11 to 8.
  • And I changed the url to spring.datasource.url=jdbc:mysql://localhost:3306/fds?useUnicode=yes&characterEncoding=UTF-8&allowPublicKeyRetrieval=true&useSSL=false
  • And also I added version to the dependency mysql-connector-java 5.1.49
  • I removed " spring.jpa.database-platform=org.hibernate.spatial.dialect.mysql.MySQLSpatial5InnoDBDialect".
  • And I added "spring.jpa.properties.hibernate.dialect= org.hibernate.spatial.dialect.mysql.MySQL56InnoDBSpatialDialect"
  • And I added one dependency: org.hibernate hibernate-core 5.4.15.Final
  • And I added one dependency:org.hibernate</groupId hibernate-spatial 5.2.3.Final
  • And I added one dependency:javax.xml.bind</groupId jaxb-api 2.3.0