You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Spring Boot启动失败:创建entityManagerFactory Bean时缺失org.jboss.logging.Logger

问题定位与解决办法

这个启动失败的核心原因是JPA(Hibernate)运行时缺少org.jboss.logging.Logger类——Hibernate依赖jboss-logging作为日志实现,但该包未被正确引入到项目依赖中,可能是依赖传递链断裂、被主动排除,或者版本不兼容导致的。

具体解决步骤

  • 显式添加jboss-logging依赖
    在你的build.gradle文件中直接引入该依赖,版本可根据Hibernate版本匹配(Spring Boot 2.x对应Hibernate 5.x,推荐用3.5.3.Final;Spring Boot 3.x对应Hibernate 6.x,可使用3.6.1.Final):

    implementation 'org.jboss.logging:jboss-logging:3.5.3.Final'
    
  • 排查依赖排除规则
    执行./gradlew dependencies命令生成依赖树,检查是否有其他依赖或全局配置主动排除了jboss-logging。如果发现类似以下的排除规则,直接移除:

    configurations.all {
        exclude group: 'org.jboss.logging', module: 'jboss-logging'
    }
    
  • 清理缓存并重建项目
    执行命令清理Gradle缓存,避免缓存的损坏依赖影响构建:

    ./gradlew clean build --refresh-dependencies
    
  • 校验Hibernate与Spring Boot版本兼容性
    如果你手动指定了Hibernate版本,确保它和当前Spring Boot版本匹配:

    • Spring Boot 2.x 适配 Hibernate 5.x
    • Spring Boot 3.x 适配 Hibernate 6.x
      建议优先使用Spring Boot starter提供的默认依赖版本,避免手动引入冲突版本。

内容的提问来源于stack exchange,提问作者Taylor

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.07 20:16:13