SpringAI调用本地RAG 启动报错 chromaDB 报错

SpringAI调用本地chromaDB 报错:

1 配置文件,正常:

复制代码
spring:
  application:
    name: RuoyiAdmin
  main:
    allow-bean-definition-overriding: true
  ai:
    openai:
      base-url: https://api.deepseek.com
      api-key: sk-ddsfsdf07826f
      chat:
        options:
          model: deepseek-reasoner
    vectorstore:
      chroma:
        client:
          host: http://localhost
          port: 8000
        collection-name: xiaofang_news
        initialize-schema: false
        tenant-name: default_tenant
        database-name: default_database
    embedding:
      transformer:
        cache:
          directory: "E:/works2/bge_raw/cache"
        onnx:
          modelUri: "file:///E:/works2/bge_raw/model.onnx"
        tokenizer:                     # 与 onnx 平级,缩进对齐
          uri: "file:///E:/works2/bge_raw/tokenizer.json"

python环境检查正常:

复制代码
# 验证集合是否是存在
import chromadb
client = chromadb.HttpClient(host='localhost', port=8000)
# Check the settings
print(f"Current Tenant: {client.tenant}")
print(f"Current Database: {client.database}")
try:
    coll = client.get_collection("xiaofang_news")
    print(f"✅ 集合存在,包含 {coll.count()} 条数据")
except Exception as e:
    print(f"❌ 集合不存在或访问失败: {e}")

2 pom.xml 版本正常:

复制代码
<dependency>
            <groupId>org.springframework.ai</groupId>
            <artifactId>spring-ai-starter-vector-store-chroma</artifactId>
            <version>1.1.3</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.ai</groupId>
            <artifactId>spring-ai-starter-model-openai</artifactId>
            <version>1.1.3</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.ai</groupId>
            <artifactId>spring-ai-starter-model-chat-memory-repository-jdbc</artifactId>
            <version>1.1.3</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.ai</groupId>
            <artifactId>spring-ai-starter-model-transformers</artifactId>
            <version>1.1.3</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.ai</groupId>
            <artifactId>spring-ai-advisors-vector-store</artifactId>
            <version>1.1.3</version>
        </dependency>

3 主要问题所在:

手动删除原先下载的版本:

E:\download\apache-maven-3.8.9\local\org\springframework\ai\spring-ai-advisors-vector-store

4 核心问题:

在父模块引入了其他版本,忘记注释,因为之前多个版本之间切换忘记:

复制代码
<dependencyManagement>
        <dependencies>
                <dependency>
                    <groupId>org.springframework.ai</groupId>
                    <artifactId>spring-ai-bom</artifactId>
                    <version>1.1.3</version>
<!--                    <version>1.0.0-M6</version>-->
                    <type>pom</type>
                    <scope>import</scope>
                </dependency>

</dependencyManagement>

2026-03-19 14:52:42 [main] INFO o.d.common.json.config.JacksonConfig

  • 初始化 jackson 配置

2026-03-19 14:52:42 [main] WARN o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext

  • Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ragController' defined in file [E:\codes2\crmeb_java_cad\RuoYi-Vue-Plus\ruoyi-admin\target\classes\org\dromara\cad\system\controller\RagController.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'vectorStore' defined in class path resource [org/springframework/ai/vectorstore/chroma/autoconfigure/ChromaVectorStoreAutoConfiguration.class]: Unsatisfied dependency expressed through method 'vectorStore' parameter 1: Error creating bean with name 'chromaApi' defined in class path resource [org/springframework/ai/vectorstore/chroma/autoconfigure/ChromaVectorStoreAutoConfiguration.class]: Failed to instantiate [org.springframework.ai.chroma.vectorstore.ChromaApi]: Factory method 'chromaApi' threw exception with message: 'org.springframework.ai.chroma.vectorstore.ChromaApi$Builder org.springframework.ai.chroma.vectorstore.ChromaApi.builder()'

2026-03-19 14:52:42 [main] ERROR 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.springframework.ai.vectorstore.chroma.autoconfigure.ChromaVectorStoreAutoConfiguration.chromaApi(ChromaVectorStoreAutoConfiguration.java:68)

The following method did not exist:

'org.springframework.ai.chroma.vectorstore.ChromaApi$Builder org.springframework.ai.chroma.vectorstore.ChromaApi.builder()'

The calling method's class, org.springframework.ai.vectorstore.chroma.autoconfigure.ChromaVectorStoreAutoConfiguration, was loaded from the following location:

jar:file:/E:/download/apache-maven-3.8.9/local/org/springframework/ai/spring-ai-autoconfigure-vector-store-chroma/1.1.3/spring-ai-autoconfigure-vector-store-chroma-1.1.3.jar!/org/springframework/ai/vectorstore/chroma/autoconfigure/ChromaVectorStoreAutoConfiguration.class

The called method's class, org.springframework.ai.chroma.vectorstore.ChromaApi, is available from the following locations:

jar:file:/E:/download/apache-maven-3.8.9/local/org/springframework/ai/spring-ai-chroma-store/1.0.0-M6/spring-ai-chroma-store-1.0.0-M6.jar!/org/springframework/ai/chroma/vectorstore/ChromaApi.class

The called method's class hierarchy was loaded from the following locations:

org.springframework.ai.chroma.vectorstore.ChromaApi: file:/E:/download/apache-maven-3.8.9/local/org/springframework/ai/spring-ai-chroma-store/1.0.0-M6/spring-ai-chroma-store-1.0.0-M6.jar

Action:

Correct the classpath of your application so that it contains compatible versions of the classes org.springframework.ai.vectorstore.chroma.autoconfigure.ChromaVectorStoreAutoConfiguration and org.springframework.ai.chroma.vectorstore.ChromaApi

2026-03-19 14:52:42 [main] WARN o.s.boot.SpringApplication

  • Unable to close ApplicationContext

java.lang.NullPointerException: Cannot invoke "java.util.List.iterator()" because "this.closeables" is null

相关推荐
极智视界9 小时前
分类数据集 - 伪造人脸和真实人脸分类数据集下载
人工智能·yolo·数据集·图像分类·算法训练·人脸伪造检测
千寻girling9 小时前
滑动窗口刷了快一个月(26天)了 , 还没有刷完. | 含(操作系统学什么的Java 后端)
java·开发语言·javascript·c++·人工智能·后端·python
GEO索引未来9 小时前
国内首部GEO可信传播标准立项通过/DeepSeek-V4 正式上线并开源/Open AI、Google继续推进AI广告标准化
大数据·人工智能·gpt·ai·chatgpt·开源
Chengbei119 小时前
面向红队的 AI 赋能全场景流量分析仪 网页 / APP / 终端 / IoT 全域 HTTPS 抓包解密利器
人工智能·物联网·网络协议·web安全·网络安全·https·系统安全
小糖学代码9 小时前
LLM系列:2.pytorch入门:9.神经网络的学习
人工智能·python·深度学习·神经网络·学习·机器学习
tangweiguo030519879 小时前
AI图生图完整实战:基于阿里云百炼通义万相
人工智能·langchain
一只AI打工虾的自我修养9 小时前
Mac mini 本地AI工作站配置指南(2026实战):从零打造 M4 Mac mini AI 开发环境
人工智能·macos
CodePlayer竟然被占用了9 小时前
少即是多:GPT-5.5 Prompt 官方指南的核心转变
人工智能
liuyunshengsir9 小时前
手写最基础的大模型推理并使用Profile监控GPU性能消耗情况
人工智能·深度学习·机器学习
翼龙云_cloud9 小时前
阿里云代理商:阿里云部署的Hermes Agent 钉钉接入指南
人工智能·阿里云·云计算·钉钉·ai 智能体·hermes agent