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

运行OrmLite连接SQLite程序时出现ClassNotFound错误如何解决

问题根源

该错误由OrmLite核心包和JDBC扩展包版本不兼容导致:你当前引入的ormlite-core版本为4.48,ormlite-jdbc版本为5.6,两个包跨大版本使用会出现类缺失问题。报错中提到的BooleanNumberFieldConverter是5.x版本才新增到core包中的类,4.48版本的core包不存在该类,高版本的jdbc包调用时就会抛出类找不到异常。

解决步骤

  • 修改pom.xml中的依赖配置,将ormlite-core的版本升级到和ormlite-jdbc一致的5.6版本,修改后的依赖段如下:
<dependencies>
    <!-- sqlite jdbc驱动 -->
    <dependency>
        <groupId>org.xerial</groupId>
        <artifactId>sqlite-jdbc</artifactId>
        <version>3.36.0.3</version>
    </dependency>
    
    <!-- ormlite核心包,版本和jdbc扩展包保持一致 -->
    <dependency>
        <groupId>com.j256.ormlite</groupId>
        <artifactId>ormlite-core</artifactId>
        <version>5.6</version>
    </dependency>

    <!-- ormlite jdbc扩展包 -->
    <dependency>
        <groupId>com.j256.ormlite</groupId>
        <artifactId>ormlite-jdbc</artifactId>
        <version>5.6</version>
    </dependency>
</dependencies>
  • 在Eclipse中右键项目,依次选择Maven -> Update Project,勾选Force Update of Snapshots/Releases后点击确定,完成依赖强制更新。
  • 重新运行程序即可解决该错误。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.09.27 13:54:04