When I upgraded from SpringBoot 2.4.2 to 2.4.5, I previously rewritten the org.hibernate.cfg.PropertyContainer and org.hibernate.cfg.InheritanceState two methods in order to adjust the order of the fields when hibernate automatically created the table, and an error was reported. The message is below:

Connected to the target VM, address: '127.0.0.1:3612', transport: 'socket'

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.4.5)

2021-05-03 21:13:30.321  INFO 17280 --- [           main] com.xuyang9978.blog.BlogApplication      : Starting BlogApplication using Java 1.8.0_231 on DESKTOP-GFNL83U with PID 17280 (D:\code\blog\blog\target\classes started by key in D:\code\blog\blog)
2021-05-03 21:13:30.335  INFO 17280 --- [           main] com.xuyang9978.blog.BlogApplication      : The following profiles are active: dev
2021-05-03 21:13:31.574  INFO 17280 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2021-05-03 21:13:31.575  INFO 17280 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2021-05-03 21:13:31.602  INFO 17280 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 14 ms. Found 0 JPA repository interfaces.
2021-05-03 21:13:31.626  INFO 17280 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2021-05-03 21:13:31.627  INFO 17280 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Redis repositories in DEFAULT mode.
2021-05-03 21:13:31.641  INFO 17280 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 2 ms. Found 0 Redis repository interfaces.
2021-05-03 21:13:32.481  INFO 17280 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2021-05-03 21:13:32.497  INFO 17280 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2021-05-03 21:13:32.497  INFO 17280 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.45]
2021-05-03 21:13:32.699  INFO 17280 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2021-05-03 21:13:32.699  INFO 17280 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2173 ms
2021-05-03 21:13:33.036  INFO 17280 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
2021-05-03 21:13:33.118  INFO 17280 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.4.30.Final
2021-05-03 21:13:33.402  INFO 17280 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2021-05-03 21:13:33.600  INFO 17280 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} inited
2021-05-03 21:13:33.852  INFO 17280 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL57Dialect
2021-05-03 21:13:34.028  WARN 17280 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: 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 java.lang.NoSuchMethodError: org.hibernate.cfg.PropertyContainer.propertyIterator()Ljava/lang/Iterable;
2021-05-03 21:13:34.029  INFO 17280 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} closing ...
2021-05-03 21:13:34.036  INFO 17280 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} closed
2021-05-03 21:13:34.041  INFO 17280 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2021-05-03 21:13:34.056  INFO 17280 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-05-03 21:13:34.084 ERROR 17280 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.hibernate.cfg.AnnotationBinder.addElementsOfClass(AnnotationBinder.java:1505)

The following method did not exist:

    org.hibernate.cfg.PropertyContainer.propertyIterator()Ljava/lang/Iterable;

The method's class, org.hibernate.cfg.PropertyContainer, is available from the following locations:

    file:/D:/code/blog/blog/target/classes/org/hibernate/cfg/PropertyContainer.class
    jar:file:/D:/Maven/localRepository/org/hibernate/hibernate-core/5.4.30.Final/hibernate-core-5.4.30.Final.jar!/org/hibernate/cfg/PropertyContainer.class

The class hierarchy was loaded from the following locations:

    org.hibernate.cfg.PropertyContainer: file:/D:/code/blog/blog/target/classes/


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.hibernate.cfg.PropertyContainer

Disconnected from the target VM, address: '127.0.0.1:3612', transport: 'socket'

Process finished with exit code 1

I tried versions below 2.4.5, but this did not happen. Referenced dependencies and rewritten classes are shown in the picture QQ图片20210503212716

Comment From: snicoll

Spring Boot 2.4.5 upgraded to Hibernate 5.4.30.Final so you'd need to check your override with recent changes there. I am afraid we can't provide you support for such an arrangement where you override classes of a third party dependency.

Comment From: raviky091

any uptate?

Comment From: jamesmokoena

currently dealing with the same issue

Comment From: wilkinsona

There is nothing to be done on the Spring Boot side. The problem reported in this issue was due to user error as a class from Hibernate was being overridden in an incompatible way. Check you classpath for a similar override or multiple Hibernate modules with different versions. If that does not help, please follow up on Stack Overflow and include a minimal, reproducible example in your question.