Hibernate 5 升级后 getProperties 错误
2023-09-27 14:20:34 时间
升级到 Hibernate 5 后,提示有错误:
- org.hibernate.engine.spi.SessionFactoryImplementor.getProperties()Ljava/util/Map;
完整的错误栈为:
- java.lang.NoSuchMethodError: org.hibernate.engine.spi.SessionFactoryImplementor.getProperties()Ljava/util/Map;
- at org.hibernate.cache.internal.EnabledCaching.<init>(EnabledCaching.java:77)
- at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:33)
- at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:24)
- at org.hibernate.service.spi.SessionFactoryServiceInitiator.initiateService(SessionFactoryServiceInitiator.java:30)
- at org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.initiateService(SessionFactoryServiceRegistryImpl.java:68)
- at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
- at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
- at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
- at org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.getService(SessionFactoryServiceRegistryImpl.java:109)
- at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:239)
- at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:467)
如果你仅仅从错误信息,你可能看不出什么问题。
Google 搜索也找不到什么好的回答。经过我们对源代码的分析和排查,我们发现这是一个 JPA 版本不兼容的问题。
你的Hibernate 可能需要更高版本的 JPA,但是你的项目中只有低版本的 JPA
有关 JPA 的支持列表可以访问页面:https://hibernate.org/orm/releases/
请查看 JPA 的版本配置列表。
根据我们的项目情况,我们需要使用 JPA 2.2,但是我们没有在 Maven 中指定 JPA 导致了上面的错误。
相关文章
- org.postgresql.util.PSQLException:错误:列user0_.id不存在–Hibernate
- Linux 服务器大量的 log 日志,如何正确看日志快速定位错误?你必须学会!
- Mac运行Android模拟器报The emulator process for AVD XXX has terminated错误
- PL/SQL连接错误:ora-12705:cannot access NLS data files or invalid environment specified
- [Linux]Linux执行sh脚本时,出现$‘r‘: command not found(未找到命令)"错误的解决方案[转载]
- 解决git bash闪退问题 报openssl错误
- idea maven javaweb项目迁移时的maven和版本报错问题解决(可解决同类错误)
- HTC Vive 与Leap Motion 出现位置错误的问题
- Centos7使用yum命令报错:“Could not resolve host: mirrors.aliyun.com; 未知的错误“
- 使用composer出现 Cannot find module (SNMPv2-TC) 等错误的解决方法
- Laravel ->Exceptions ->Handler-> render错误异常的封装
- pyhton学习之ModuleNotFoundError: No module named 'win32api'错误
- 【错误记录】Google Play 上架报错 ( 我们检测到您的应用程序包含未经认证的广告SDK或未经批准用于儿童导向服务的SDK )
- java中出现绑定异常,MyBatis绑定错误提示BindingException:Invalid bound statement (not found)的解决方法...
- 【mysql】service mysql start出错,mysql启动不了,解决mysql: unrecognized service错误
- 我的Java开发学习之旅------>Workspace in use or cannot be created, choose a different one.--错误解决办法
- ORA-01103错误解析