Cannot enable lazy loading because Javassist is not available. Add Javassist to your classpath.

在使用maven工程将mybatis源码引入,方便代码调试与阅读源码。但是引入后使用懒加载报错,异常如题。

百度表示,它缺少以下JAR包,但发现引入后仍报告错误。[en]Baidu said that it lacked the following jar package, but found that it still reported an error after it was introduced.

<dependency>
    <groupId>cglibgroupId>
    <artifactId>cglibartifactId>
    <version>3.2.5version>
dependency>

理论上,当引用源代码模块时,应该不会缺少JAR,错误消息应该是缺少Javassit的JAR包。让我们转到mybatis的源代码pom.xml以复制相应的JAR并重新构建项目。地址如下(POM完全从源代码复制):[en]In theory, when referencing the source code module, there should be no shortage of jar, and the error message should be the jar package that lacks Javassit. Let’s go to the source code pom.xml of mybatis to copy the corresponding jar and re-build the project. The address is as follows (completely copied from the source code by pom):

<dependency>
    <groupId>ognlgroupId>
    <artifactId>ognlartifactId>
    <version>3.2.15version>
    <scope>compilescope>
    <optional>trueoptional>
dependency>
<dependency>
    <groupId>org.javassistgroupId>
    <artifactId>javassistartifactId>
    <version>3.27.0-GAversion>
    <scope>compilescope>
    <optional>trueoptional>
dependency>

Original: https://blog.csdn.net/weixin_45056780/article/details/113449245
Author: 世代农民
Title: Cannot enable lazy loading because Javassist is not available. Add Javassist to your classpath.

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/6097/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

发表回复

登录后才能评论
免费咨询
免费咨询
扫码关注
扫码关注
联系站长

站长Johngo!

大数据和算法重度研究者!

持续产出大数据、算法、LeetCode干货,以及业界好资源!

2022012703491714

微信来撩,免费咨询:xiaozhu_tec

分享本页
返回顶部